+ * Test repeat contribution successfully creates line items (plural).
+ */
+ public function testRepeatTransactionLineItems() {
+ // CRM-19309
+ $originalContribution = $this->setUpRepeatTransaction($recurParams = array(), 'multiple');
+ $this->callAPISuccess('contribution', 'repeattransaction', array(
+ 'original_contribution_id' => $originalContribution['id'],
+ 'contribution_status_id' => 'Completed',
+ 'trxn_id' => uniqid(),
+ ));
+
+ $lineItemParams = array(
+ 'entity_id' => $originalContribution['id'],
+ 'sequential' => 1,
+ 'return' => array(
+ 'entity_table',
+ 'qty',
+ 'unit_price',
+ 'line_total',
+ 'label',
+ 'financial_type_id',
+ 'deductible_amount',
+ 'price_field_value_id',
+ 'price_field_id',
+ ),
+ );
+ $lineItem1 = $this->callAPISuccess('line_item', 'get', array_merge($lineItemParams, array(
+ 'entity_id' => $originalContribution['id'],
+ )));
+ $lineItem2 = $this->callAPISuccess('line_item', 'get', array_merge($lineItemParams, array(
+ 'entity_id' => $originalContribution['id'] + 1,
+ )));
+
+ // unset id and entity_id for all of them to be able to compare the lineItems:
+ unset($lineItem1['values'][0]['id'], $lineItem1['values'][0]['entity_id']);
+ unset($lineItem2['values'][0]['id'], $lineItem2['values'][0]['entity_id']);
+ $this->assertEquals($lineItem1['values'][0], $lineItem2['values'][0]);
+
+ unset($lineItem1['values'][1]['id'], $lineItem1['values'][1]['entity_id']);
+ unset($lineItem2['values'][1]['id'], $lineItem2['values'][1]['entity_id']);
+ $this->assertEquals($lineItem1['values'][1], $lineItem2['values'][1]);
+
+ // CRM-19309 so in future we also want to:
+ // check that financial_line_items have been created for entity_id 3 and 4;
+
+ $this->callAPISuccessGetCount('FinancialItem', array('description' => 'Sales Tax', 'amount' => 0), 0);
+ $this->quickCleanUpFinancialEntities();
+ }
+
+ /**
+ * Test repeat contribution successfully creates is_test transaction.