Example #1
0
 /**
  * @expectedException \Repo2\QueryBuilder\Exception\CompileException
  * @expectedExceptionMessage The table definition requires columns list.
  */
 public function testErrorOnEmptyColumns()
 {
     $expr = new CreateTable(new Reference('user'), new ExpressionBag());
     $expr->compile(Mock::getMysqliDriver($this));
 }
Example #2
0
 /**
  * @expectedException \Repo2\QueryBuilder\Exception\CompileException
  * @expectedExceptionMessage No values found for update query.
  */
 public function testErrorOnEmptyValues()
 {
     $select = new UpdateQuery(new Reference('user'), new ExpressionBag());
     $select->compile(Mock::getMysqliDriver($this));
 }
Example #3
0
 /**
  * @expectedException \Repo2\QueryBuilder\Exception\CompileException
  * @expectedExceptionMessage Data type for the column "id" not defined.
  */
 public function testErrorOnEmptyType()
 {
     $this->createColumn()->compile(Mock::getMysqliDriver($this));
 }
Example #4
0
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage The field "x" is not found in the row.
  */
 public function testErrorOnWrongRowSequenceInPipe()
 {
     $insert = QueryBuilder\insert('user')->pipe(['x' => 1])->pipe(['y' => 2]);
     $insert->compile(Mock::getMysqliDriver($this));
 }
 /**
  * @expectedException \Repo2\QueryBuilder\Exception\CompileException
  * @expectedExceptionMessage The value must be a numeric for increment assignment. Given "string".
  */
 public function testWrongSortType()
 {
     $assign = QueryBuilder\inc('test', 'non_numeric_value');
     $assign->compile(Mock::getMysqliDriver($this));
 }
Example #6
0
 /**
  * @dataProvider provideGoodField
  */
 public function testGoodQuote($field)
 {
     $this->assertSame('`' . $field . '`', Mock::getMysqliDriver($this)->quote($field));
 }