/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { include 'config.php'; $transport = getTransport($config); $mapper = new XmlMapper(); $this->apiConnector = new ApiConnector($config['clientname'], $transport, $mapper); $this->service = $this->apiConnector->getService('Invoice'); if (!is_null(self::$invoiceId)) { $this->object = $this->service->getById(self::$invoiceId); } }
/** * @covers Moneybird\Contact::getIncomingInvoices */ public function testGetIncomingInvoices() { $invoices = $this->object->getIncomingInvoices($this->apiConnector->getService('IncomingInvoice')); $this->assertGreaterThan(0, count($invoices), 'No invoices found'); foreach ($invoices as $invoice) { $this->assertEquals(self::$contactId, $invoice->contactId); $invoice->delete($this->apiConnector->getService('IncomingInvoice')); } }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { if (file_exists('../config.php')) { include '../config.php'; } else { include 'config.php'; } $transport = getTransport($config); $mapper = new XmlMapper(); $connector = new ApiConnector($config['clientname'], $transport, $mapper); $this->object = $connector->getService('Product'); }
/** * @coversNothing */ public function testToXmlRecurringTemplate() { $details = new \Subclass_RecurringTemplate_Detail_Array(); $details->append(new \Subclass_RecurringTemplate_Detail(array('amount' => 5, 'description' => 'My template line', 'price' => 20, 'taxRateId' => self::$taxRateId))); $details->append(new \Subclass_RecurringTemplate_Detail(array('amount' => 1, 'description' => 'My second template line', 'price' => 12, 'taxRateId' => self::$taxRateId))); $template = new \SubclassRecurringTemplate(array('poNumber' => 'PO Number', 'details' => $details, 'frequencyType' => RecurringTemplate::FREQUENCY_YEAR), self::$contact); $template->save($this->apiConnector->getService('RecurringTemplate')); $this->assertInstanceOf('Moneybird\\RecurringTemplate', $template); $this->assertInstanceOf('\\SubclassRecurringTemplate', $template); $this->assertNotNull($template->id); $this->assertGreaterThan(0, $template->id); }