/**
  * https://github.com/yiisoft/yii/issues/2426
  */
 public function testWakeupWhenSqlContainingFieldsAreArraysWithSpecifiedParams()
 {
     CDbCriteria::$paramCount = 10;
     $criteria = new CDbCriteria();
     $criteria->select = array('id', 'title');
     $criteria->condition = 'id=:postId';
     $criteria->params['postId'] = 1;
     $criteria->compare('authorId', 2);
     $oldCriteria = clone $criteria;
     $criteria = serialize($criteria);
     CDbCriteria::$paramCount = 10;
     $criteria = unserialize($criteria);
     $this->assertEquals($oldCriteria, $criteria);
 }
Beispiel #2
0
 /**
  * @covers CDbCriteria::addBetweenCondition
  */
 function testAddBetweenCondition()
 {
     CDbCriteria::$paramCount = 0;
     $criteria = new CDbCriteria();
     $criteria->addBetweenCondition('A', 1, 2);
     $this->assertEquals('A BETWEEN :ycp0 AND :ycp1', $criteria->condition);
     $this->assertEquals(1, $criteria->params[':ycp0']);
     $this->assertEquals(2, $criteria->params[':ycp1']);
 }