Пример #1
0
 /**
  * @covers Openbuildings\Kohana\DB::expr
  */
 public function test_expr()
 {
     $result = DB::expr('SQL EXPRESSION');
     $this->assertInstanceOf('Openbuildings\\Kohana\\Database_Expression', $result);
     $this->assertEquals('SQL EXPRESSION', $result->compile());
 }
Пример #2
0
 /**
  * @covers Openbuildings\Kohana\Database::quote
  */
 public function test_quote()
 {
     $this->assertSame('NULL', $this->database->quote(NULL));
     $this->assertSame(10, $this->database->quote(10));
     $this->assertSame("'1'", $this->database->quote(TRUE));
     $this->assertSame("'0'", $this->database->quote(FALSE));
     $this->assertSame("'test to string'", $this->database->quote(new Test_ToString_Class()));
     $this->assertSame("test", $this->database->quote(DB::expr('test')));
     $this->assertSame("(SELECT name, id)", $this->database->quote(DB::select('name', 'id')));
     $this->assertSame("'free text'", $this->database->quote('free text'));
     $this->assertSame("('1', 20)", $this->database->quote(array('1', 20)));
     $this->assertSame("5.123000", $this->database->quote(5.123));
 }