Ejemplo n.º 1
0
 public function testToArray()
 {
     $this->if($qb = new QueryBuilderTested())->and($this->mockClass('Spy\\Timeline\\Driver\\QueryBuilder\\Criteria\\CriteriaInterface', '\\Mock'))->and($this->mockClass('Spy\\Timeline\\Model\\ComponentInterface', '\\Mock'))->and($subject = new \Mock\ComponentInterface())->and($subject->getMockController()->getHash = 'hash')->and($criteria = new \Mock\CriteriaInterface())->and($criteria->getMockController()->toArray = 'TOARRAYRESULT')->and($qb->setCriterias($criteria))->and($qb->setPage(10))->and($qb->setMaxPerPage(100))->and($qb->orderBy('createdAt', 'DESC'))->and($qb->addSubject($subject))->array($qb->toArray())->isIdenticalTo(array('subject' => array('hash'), 'page' => 10, 'max_per_page' => 100, 'criterias' => 'TOARRAYRESULT', 'sort' => array('createdAt', 'DESC')));
 }
Ejemplo n.º 2
0
 public function testToArray()
 {
     $this->if($model = new TestedModel())->and($this->mockClass('Spy\\Timeline\\Driver\\QueryBuilder\\Criteria\\CriteriaInterface', '\\Mock'))->and($criteria = new \Mock\CriteriaInterface())->and($criteria->getMockController()->toArray = 'CRITERIA_TO_ARRAY')->and($model->addCriteria($criteria))->and($model->setType('AND'))->array($model->toArray())->isEqualTo(array('type' => 'operator', 'value' => 'AND', 'criterias' => array('CRITERIA_TO_ARRAY')));
 }