forked from LiveCarta/PayPal-PHP-SDK
Adding a test that will fail with the current code
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\Item;
|
||||
use PayPal\Api\ItemList;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -58,4 +59,23 @@ class ItemListTest extends TestCase
|
||||
$this->assertEquals($obj->getShippingMethod(), "TestSample");
|
||||
$this->assertEquals($obj->getShippingPhoneNumber(), "TestSample");
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param ItemList $obj
|
||||
*/
|
||||
public function testAddRemove($obj)
|
||||
{
|
||||
$item2 = new Item(ItemTest::getJSON());
|
||||
$item2->setSku('TestSample2');
|
||||
$item3 = new Item(ItemTest::getJSON());
|
||||
$item3->setSku('TestSample3');
|
||||
$obj->addItem($item2);
|
||||
$obj->addItem($item3);
|
||||
$this->assertCount(3, $obj->getItems());
|
||||
$obj->removeItem($item2);
|
||||
|
||||
$this->assertCount(2, $obj->getItems());
|
||||
$this->assertContains('"items":[', $obj->toJSON());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user