From d4df7755e53eb8a74f05dc80b0a9cbf0f9135fdd Mon Sep 17 00:00:00 2001 From: Johan Vervloet Date: Wed, 13 Aug 2014 15:37:51 +0200 Subject: [PATCH] CRM-15104 - Rewrote the unit test. I think Jenkins didn't like my unit test. It showed this message: PHP Parse error: syntax error, unexpected '[' in /srv/buildkit/build/build-3/sites/all/modules/civicrm/tests/phpunit/api/v3/ParticipantTest.php on line 492 I rewrote the unit test with less '[' on that line. Hoping that Jenkins will be happy now :-) ---------------------------------------- * CRM-15104: Line item issues when creating a participant using the API https://issues.civicrm.org/jira/browse/CRM-15104 --- tests/phpunit/api/v3/ParticipantTest.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/phpunit/api/v3/ParticipantTest.php b/tests/phpunit/api/v3/ParticipantTest.php index 352201cdef..91ca2e99f4 100644 --- a/tests/phpunit/api/v3/ParticipantTest.php +++ b/tests/phpunit/api/v3/ParticipantTest.php @@ -489,12 +489,16 @@ class api_v3_ParticipantTest extends CiviUnitTestCase { // Check quantity, label and unit price of lines. // TODO: These assertions depend on the order of the line items, which is // technically incorrect. - $this->assertEquals(2, array_values($lineItems['values'])[0]['qty']); - $this->assertEquals(20, array_values($lineItems['values'])[0]['unit_price']); - $this->assertEquals('pricefieldvalue1', array_values($lineItems['values'])[0]['label']); - $this->assertEquals(2, array_values($lineItems['values'])[1]['qty']); - $this->assertEquals(5, array_values($lineItems['values'])[1]['unit_price']); - $this->assertEquals('pricefieldvalue2', array_values($lineItems['values'])[1]['label']); + + $lineItem = array_pop($lineItems['values']); + $this->assertEquals(2, $lineItem['qty']); + $this->assertEquals(5, $lineItem['unit_price']); + $this->assertEquals('pricefieldvalue2', $lineItem['label']); + + $lineItem = array_pop($lineItems['values']); + $this->assertEquals(2, $lineItem['qty']); + $this->assertEquals(20, $lineItem['unit_price']); + $this->assertEquals('pricefieldvalue1', $lineItem['label']); // Cleanup $this->callAPISuccess('participant', 'delete', array('id' => $participant['id'])); -- 2.25.1