Updated Invoicing APIs

- Updated Model objects.
- Updated Samples.
- Updated Tests.
This commit is contained in:
Jay Patel
2016-07-13 15:16:25 -05:00
parent 9534bcb176
commit c714f77980
48 changed files with 3320 additions and 2881 deletions

View File

@@ -17,7 +17,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase
*/
public static function getJson()
{
return '{"name":"TestSample","description":"TestSample","quantity":"12.34","unit_price":' .CurrencyTest::getJson() . ',"tax":' .TaxTest::getJson() . ',"date":"TestSample","discount":' .CostTest::getJson() . '}';
return '{"name":"TestSample","description":"TestSample","quantity":"12.34","unit_price":' .CurrencyTest::getJson() . ',"tax":' .TaxTest::getJson() . ',"date":"TestSample","discount":' .CostTest::getJson() . ',"image_url":"http://www.google.com","unit_of_measure":"TestSample"}';
}
/**
@@ -45,6 +45,8 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase
$this->assertNotNull($obj->getTax());
$this->assertNotNull($obj->getDate());
$this->assertNotNull($obj->getDiscount());
$this->assertNotNull($obj->getImageUrl());
$this->assertNotNull($obj->getUnitOfMeasure());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
@@ -62,6 +64,18 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($obj->getTax(), TaxTest::getObject());
$this->assertEquals($obj->getDate(), "TestSample");
$this->assertEquals($obj->getDiscount(), CostTest::getObject());
$this->assertEquals($obj->getImageUrl(), "http://www.google.com");
$this->assertEquals($obj->getUnitOfMeasure(), "TestSample");
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage ImageUrl is not a fully qualified URL
*/
public function testUrlValidationForImageUrl()
{
$obj = new InvoiceItem();
$obj->setImageUrl(null);
}
}