clear() public method

Removes all the values.
public clear ( ) : void
return void
Example #1
0
 /**
  * @dataProvider everything
  */
 public function testThatSetIndexWithNoKeyAppendsTheValueWithTheNextLargestIntGreaterThanOrEqualToZeroLikeAnArray(\Pinq\ICollection $collection, array $data)
 {
     $collection->clear();
     $collection[-5] = 'foo';
     $collection[] = 'bar';
     $collection[7] = 'baz';
     $collection[] = 'qux';
     $this->assertSame('foo', $collection[-5]);
     $this->assertSame('bar', $collection[0]);
     $this->assertSame('baz', $collection[7]);
     $this->assertSame('qux', $collection[8]);
     unset($collection[8]);
     $this->assertFalse(isset($collection[8]));
     $collection[] = 'qux1';
     $this->assertSame('qux1', $collection[8]);
     unset($collection[8], $collection[7]);
     $collection[] = 'boo';
     $this->assertSame('boo', $collection[1]);
 }
Example #2
0
 public function visitClear(Operations\Clear $operation)
 {
     $this->collection->clear();
 }
Example #3
0
 /**
  * @dataProvider everything
  */
 public function testThatClearRemovesAllItems(\Pinq\ICollection $collection, array $data)
 {
     $collection->clear();
     $this->assertCount(0, $collection);
     $this->assertMatchesValues($collection, []);
 }