Example #1
0
 public function testWhere()
 {
     $this->object[0];
     // initialize collection
     $this->assertTrue($this->object->isLoaded());
     // change conditions
     $this->object->where("[allowed] = %b", false);
     $this->assertFalse($this->object->isLoaded());
     // test result
     $i = 0;
     foreach ($this->object as $item) {
         $this->assertEquals(false, $item->allowed);
         $i++;
     }
     $this->assertEquals(2, $i);
     // change conditions
     $this->object->where("[name] = %s", "Article");
     $this->assertEquals(1, count($this->object));
 }