function testNaturalInnerJoin() { $users = $this->users; $profiles = new Table("profiles"); $select = $users->project(Sirel::star())->innerJoin($profiles)->natural(); $sqlString = "SELECT * FROM users NATURAL INNER JOIN profiles;"; $this->assertEquals($sqlString, $select->toSql()); }
function testSelectWhereUsernamePassword() { $users = new Table("users"); $query = $users->project(Sirel::star())->where($users['username']->eq('john'))->where($users['password']->eq('john1234')); $result = $this->fetchAll($query); $this->assertEquals(1, count($result)); $user = array_pop($result); $this->assertEquals(1, $user['id']); $this->assertEquals("john", $user['username']); }
function testStar() { $star = Sirel::star(); $this->assertInstanceOf('\\Sirel\\Node\\SqlLiteral', $star); $this->assertEquals('*', $star->expression); }