Example #1
0
 public function testExistElement()
 {
     $collection = new Collection();
     $el1 = new \T4\Core\Std(['id' => 1, 'title' => 'foo', 'text' => 'FooFooFoo']);
     $collection->append($el1);
     $el2 = new \T4\Core\Std(['id' => 2, 'title' => 'bar', 'text' => 'BarBarBar']);
     $collection->append($el2);
     $this->assertTrue($collection->existsElement(['id' => 1]));
     $this->assertFalse($collection->existsElement(['id' => 3]));
     $this->assertTrue($collection->existsElement(['title' => 'foo']));
     $this->assertTrue($collection->existsElement(['title' => 'foo', 'text' => 'FooFooFoo']));
     $this->assertFalse($collection->existsElement(['title' => 'foo', 'text' => 'BarBarBar']));
 }