예제 #1
0
 /**
  * @basedata false
  */
 public function testBooleanCondition()
 {
     $a = new Author();
     $ret = $a->create(array('name' => 'a', 'email' => 'a@a', 'identity' => 'a', 'confirmed' => false));
     $this->resultOK(true, $ret);
     $ret = $a->create(array('name' => 'b', 'email' => 'b@b', 'identity' => 'b', 'confirmed' => true));
     $this->resultOK(true, $ret);
     $authors = new \AuthorBooks\Model\AuthorCollection();
     $authors->where()->equal('confirmed', false);
     $ret = $authors->fetch();
     ok($ret);
     is(1, $authors->size());
     $authors = new \AuthorBooks\Model\AuthorCollection();
     $authors->where()->equal('confirmed', true);
     $ret = $authors->fetch();
     ok($ret);
     is(1, $authors->size());
     $authors->delete();
 }
예제 #2
0
 /**
  * @basedata false
  */
 public function testBooleanCondition()
 {
     $a = new Author();
     $ret = $a->create(array('name' => 'a', 'email' => 'a@a', 'identity' => 'a', 'confirmed' => false));
     $this->resultOK(true, $ret);
     $this->assertFalse($a->confirmed);
     $ret = $a->create(array('name' => 'b', 'email' => 'b@b', 'identity' => 'b', 'confirmed' => true));
     $this->resultOK(true, $ret);
     $this->assertTrue($a->confirmed);
     $authors = new AuthorCollection();
     $this->assertEquals(2, $authors->size(), 'created two authors');
     // test collection query with boolean value
     $authors = new AuthorCollection();
     $authors->where()->equal('confirmed', false);
     $ret = $authors->fetch();
     ok($ret);
     is(1, $authors->size());
     $authors = new \AuthorBooks\Model\AuthorCollection();
     $authors->where()->equal('confirmed', true);
     $ret = $authors->fetch();
     ok($ret);
     is(1, $authors->size());
     $authors->delete();
 }