/**
  * BitmaskedBehaviorTest::testContains()
  *
  * @return void
  */
 public function testContains()
 {
     $res = $this->Comments->containsBit(BitmaskedComment::STATUS_PUBLISHED);
     $expected = ['(BitmaskedComments.status & 2 = 2)'];
     $this->assertEquals($expected, $res);
     $conditions = $res;
     $res = $this->Comments->find('all', ['conditions' => $conditions])->toArray();
     $this->assertTrue(!empty($res) && count($res) === 3);
     // multiple (AND)
     $res = $this->Comments->containsBit([BitmaskedComment::STATUS_PUBLISHED, BitmaskedComment::STATUS_ACTIVE]);
     $expected = ['(BitmaskedComments.status & 3 = 3)'];
     $this->assertEquals($expected, $res);
     $conditions = $res;
     $res = $this->Comments->find('all', ['conditions' => $conditions])->toArray();
     $this->assertTrue(!empty($res) && count($res) === 2);
 }
 /**
  * @return void
  */
 public function testContains()
 {
     $config = $this->Comments->connection()->config();
     $isPostgres = strpos($config['driver'], 'Postgres') !== false;
     $res = $this->Comments->containsBit(BitmaskedComment::STATUS_PUBLISHED);
     $expected = ['(BitmaskedComments.status & 2 = 2)'];
     if ($isPostgres) {
         $expected = ['("BitmaskedComments"."status" & 2 = 2)'];
     }
     $this->assertEquals($expected, $res);
     $conditions = $res;
     $res = $this->Comments->find('all', ['conditions' => $conditions])->toArray();
     $this->assertTrue(!empty($res) && count($res) === 3);
     // multiple (AND)
     $res = $this->Comments->containsBit([BitmaskedComment::STATUS_PUBLISHED, BitmaskedComment::STATUS_ACTIVE]);
     $expected = ['(BitmaskedComments.status & 3 = 3)'];
     if ($isPostgres) {
         $expected = ['("BitmaskedComments"."status" & 3 = 3)'];
     }
     $this->assertEquals($expected, $res);
     $conditions = $res;
     $res = $this->Comments->find('all', ['conditions' => $conditions])->toArray();
     $this->assertTrue(!empty($res) && count($res) === 2);
 }