public function testField()
 {
     $this->if($qb = new QueryBuilderTested())->exception(function () use($qb) {
         $qb->field('unknownfield');
     })->isInstanceOf('\\InvalidArgumentException')->hasMessage('Field "unknownfield" not supported, prefer: context, verb, createdAt, type, text, model, identifier')->and($resultExpected = new Asserter())->and($resultExpected->field('createdAt'))->object($qb->field('createdAt'))->isEqualTo($resultExpected);
 }
Example #2
0
 /**
  * @dataProvider getAsserters
  */
 public function testFromArray($method, $operator, $data)
 {
     $this->if($model = new TestedModel())->and($resultExpected = new TestedModel())->and($resultExpected->field('field'))->and($resultExpected->create($operator, $data))->and($arrayRepresentation = array('type' => 'expr', 'value' => array('field', $operator, $data)))->object($model->fromArray($arrayRepresentation))->isEqualTo($resultExpected);
 }