Adding a test that will fail with the current code

This commit is contained in:
Benjamin Pick
2018-01-10 14:34:06 +01:00
parent f5c5325ae8
commit 1950b156ef

View File

@@ -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());
}
}