| 1 | <?php |
||
| 16 | class ClearableTraitTest extends \PHPUnit_Framework_TestCase |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @var Collection |
||
| 20 | */ |
||
| 21 | private $collection; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * {@inheritdoc} |
||
| 25 | */ |
||
| 26 | public function setUp() |
||
| 27 | { |
||
| 28 | parent::setUp(); |
||
| 29 | |||
| 30 | $this->collection = new Collection([1, 2, 3, 'a' => 4, 'b' => 5]); |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Test emptying collection |
||
| 35 | * |
||
| 36 | * @return void |
||
| 37 | */ |
||
| 38 | public function testClear() |
||
| 39 | { |
||
| 40 | $this->collection->clear(); |
||
| 41 | |||
| 42 | $this->assertAttributeEmpty('elements', $this->collection); |
||
| 43 | $this->assertAttributeCount(0, 'elements', $this->collection); |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Test collection empty method |
||
| 48 | * |
||
| 49 | * @return void |
||
| 50 | */ |
||
| 51 | public function testIsEmpty() |
||
| 52 | { |
||
| 53 | $this->assertFalse($this->collection->isEmpty()); |
||
| 54 | $this->collection->clear(); |
||
| 55 | $this->assertTrue($this->collection->isEmpty()); |
||
| 56 | } |
||
| 57 | } |
||
| 58 |