/** * @covers Moneybird\RecurringTemplate::save */ public function testSave() { $details = new RecurringTemplate\Detail\ArrayObject(); $details->append(new RecurringTemplate\Detail(array('amount' => 5, 'description' => 'My template line', 'price' => 20, 'taxRateId' => self::$taxRateId))); $details->append(new RecurringTemplate\Detail(array('amount' => 1, 'description' => 'My second template line', 'price' => 12, 'taxRateId' => self::$taxRateId))); $template = new RecurringTemplate(array('poNumber' => 'PO Number', 'details' => $details, 'frequencyType' => RecurringTemplate::FREQUENCY_YEAR), self::$contact); $template->save($this->service); $this->assertInstanceOf('Moneybird\\RecurringTemplate', $template); self::$templateId = $template->id; $this->assertNotNull(self::$templateId); $this->assertGreaterThan(0, self::$templateId); $this->assertEquals(2, count($template->details)); }
/** * @covers Moneybird\Contact::createRecurringTemplate */ public function testCreateRecurringTemplate() { $details = new RecurringTemplate\Detail\ArrayObject(); $details->append(new RecurringTemplate\Detail(array('amount' => 5, 'description' => 'My invoice line', 'price' => 20, 'tax' => 0.19))); $details->append(new RecurringTemplate\Detail(array('amount' => 1, 'description' => 'My second invoice line', 'price' => 12, 'tax' => 0.19))); $template = $this->object->createRecurringTemplate(array('details' => $details, 'frequencyType' => RecurringTemplate::FREQUENCY_YEAR)); $template->save($this->apiConnector->getService('RecurringTemplate')); }