| @@ 67-83 (lines=17) @@ | ||
| 64 | /* |
|
| 65 | * Test contains. |
|
| 66 | */ |
|
| 67 | public function testContains() |
|
| 68 | { |
|
| 69 | $this |
|
| 70 | ->given( |
|
| 71 | $unique = $this->uniqueValue(), |
|
| 72 | $collection = $this->randomCollection() |
|
| 73 | ) |
|
| 74 | ->then() |
|
| 75 | ->boolean($collection->contains($unique)) |
|
| 76 | ->isFalse() |
|
| 77 | ->and |
|
| 78 | ->when($collection->add($unique)) |
|
| 79 | ->then() |
|
| 80 | ->boolean($collection->contains($unique)) |
|
| 81 | ->isTrue() |
|
| 82 | ; |
|
| 83 | } |
|
| 84 | ||
| 85 | /* |
|
| 86 | * Test removeAt. |
|
| @@ 68-84 (lines=17) @@ | ||
| 65 | /* |
|
| 66 | * Test contains. |
|
| 67 | */ |
|
| 68 | public function testContains() |
|
| 69 | { |
|
| 70 | $this |
|
| 71 | ->given( |
|
| 72 | $unique = $this->uniqueValue(), |
|
| 73 | $collection = $this->randomCollection() |
|
| 74 | ) |
|
| 75 | ->then() |
|
| 76 | ->boolean($collection->contains($unique)) |
|
| 77 | ->isFalse() |
|
| 78 | ->and |
|
| 79 | ->when($collection->add($unique)) |
|
| 80 | ->then() |
|
| 81 | ->boolean($collection->contains($unique)) |
|
| 82 | ->isTrue() |
|
| 83 | ; |
|
| 84 | } |
|
| 85 | ||
| 86 | /* |
|
| 87 | * Test containsAll. |
|
| @@ 53-66 (lines=14) @@ | ||
| 50 | /** |
|
| 51 | * Test add. |
|
| 52 | */ |
|
| 53 | public function testAdd() |
|
| 54 | { |
|
| 55 | $this |
|
| 56 | ->given($collection = $this->randomCollection()) |
|
| 57 | ->and($unique = $this->uniqueValue()) |
|
| 58 | ->and($count = $collection->count()) |
|
| 59 | ->when($collection->add($unique)) |
|
| 60 | ->then() |
|
| 61 | ->list($collection) |
|
| 62 | ->contains($unique) |
|
| 63 | ->size() |
|
| 64 | ->isEqualTo($count + 1) |
|
| 65 | ; |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * Test add. |
|
| @@ 70-83 (lines=14) @@ | ||
| 67 | /** |
|
| 68 | * Test add. |
|
| 69 | */ |
|
| 70 | public function testAdd() |
|
| 71 | { |
|
| 72 | $this |
|
| 73 | ->given($collection = $this->emptyCollection()) |
|
| 74 | ->and($unique = $this->uniqueValue()) |
|
| 75 | ->when($collection->add($unique)) |
|
| 76 | ->and($collection->add($unique)) |
|
| 77 | ->then() |
|
| 78 | ->set($collection) |
|
| 79 | ->contains($unique) |
|
| 80 | ->size() |
|
| 81 | ->isEqualTo(1) |
|
| 82 | ; |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|
| 86 | * Test add. |
|