示例#1
0
文件: QueryTest.php 项目: atk4/dsql
 /**
  * Testing field - defaultField.
  *
  * @covers ::field
  * @covers ::_render_field
  */
 public function testFieldDefaultField()
 {
     // default defaultField
     $this->assertEquals('*', PHPUnitUtil::callProtectedMethod($this->q(), '_render_field'));
     // defaultField as custom string - not escaped
     $this->assertEquals('id', PHPUnitUtil::callProtectedMethod($this->q(['defaultField' => 'id']), '_render_field'));
     // defaultField as custom string with dot - not escaped
     $this->assertEquals('all.values', PHPUnitUtil::callProtectedMethod($this->q(['defaultField' => 'all.values']), '_render_field'));
     // defaultField as Expression object - not escaped
     $this->assertEquals('values()', PHPUnitUtil::callProtectedMethod($this->q(['defaultField' => new Expression('values()')]), '_render_field'));
 }
示例#2
0
 /**
  * Only Expressions or Expressionable objects may be used in Expression.
  *
  * @covers ::_consume
  * @expectedException atk4\dsql\Exception
  */
 public function testConsumeException2()
 {
     PHPUnitUtil::callProtectedMethod($this->e(), '_consume', [new \StdClass()]);
 }