factory() public static method

Static method to instantiate the SQL object and return itself to facilitate chaining methods together.
public static factory ( Db $db, mixed $table = null, string $alias = null ) : Sql
$db Db
$table mixed
$alias string
return Sql
コード例 #1
0
ファイル: PredicateTest.php プロジェクト: nicksagona/PopPHP
 public function testIsNotNull()
 {
     $p = new Predicate(Sql::factory(Db::factory('Sqlite', array('database' => __DIR__ . '/../tmp/test.sqlite')), 'users'));
     $p->isNotNull('email');
     $this->assertEquals('("email" IS NOT NULL)', (string) $p);
 }
コード例 #2
0
ファイル: SqlTest.php プロジェクト: nicksagona/PopPHP
 public function testConstructor()
 {
     $this->assertInstanceOf('Pop\\Db\\Sql', new Sql(Db::factory('Sqlite', array('database' => __DIR__ . '/../tmp/test.sqlite')), 'users'));
     $this->assertInstanceOf('Pop\\Db\\Sql', Sql::factory(Db::factory('Sqlite', array('database' => __DIR__ . '/../tmp/test.sqlite')), 'users'));
 }