-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
522bfcb
commit 719094b
Showing
3 changed files
with
39 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,18 +64,18 @@ public function testSelectFields() | |
$this->assertEquals('SELECT id, email FROM users', $this->queryMaker->getStatement()); | ||
} | ||
|
||
public function testSelectFieldsWhere() | ||
public function testSelectFieldsWhereOperator() | ||
{ | ||
$this->queryMaker->select('users', ['id', 'email'])->where('id', 3); | ||
$this->assertEquals('SELECT id, email FROM users WHERE id=\'3\'', $this->queryMaker->getQuery()); | ||
$this->assertEquals('SELECT id, email FROM users WHERE id=:id', $this->queryMaker->getStatement()); | ||
$this->queryMaker->select('users', ['id', 'email'])->where('id', '3', '>='); | ||
$this->assertEquals('SELECT id, email FROM users WHERE id >= \'3\'', $this->queryMaker->getQuery()); | ||
$this->assertEquals('SELECT id, email FROM users WHERE id >= :id', $this->queryMaker->getStatement()); | ||
} | ||
|
||
public function testSelectFieldsWhereOperator() | ||
public function testSelectFieldsLIKE() | ||
{ | ||
$this->queryMaker->select('users', ['id', 'email'])->where('id', '3', '>='); | ||
$this->assertEquals('SELECT id, email FROM users WHERE id>=\'3\'', $this->queryMaker->getQuery()); | ||
$this->assertEquals('SELECT id, email FROM users WHERE id>=:id', $this->queryMaker->getStatement()); | ||
$this->queryMaker->select('users', ['id', 'email'])->where('email', '%gmail%', 'LIKE'); | ||
$this->assertEquals('SELECT id, email FROM users WHERE email LIKE \'%gmail%\'', $this->queryMaker->getQuery()); | ||
$this->assertEquals('SELECT id, email FROM users WHERE email LIKE :email', $this->queryMaker->getStatement()); | ||
} | ||
|
||
public function testUpdate() | ||
|
@@ -88,11 +88,11 @@ public function testUpdate() | |
3 | ||
); | ||
$this->assertEquals( | ||
"UPDATE users SET email='[email protected]', username='midorikocak' WHERE id='3'", | ||
"UPDATE users SET email = '[email protected]', username = 'midorikocak' WHERE id = '3'", | ||
$this->queryMaker->getQuery() | ||
); | ||
$this->assertEquals( | ||
"UPDATE users SET email=:email, username=:username WHERE id=:id", | ||
"UPDATE users SET email = :email, username = :username WHERE id = :id", | ||
$this->queryMaker->getStatement() | ||
); | ||
} | ||
|
@@ -115,11 +115,11 @@ public function testWhereAnd() | |
{ | ||
$this->queryMaker->select('users', ['id', 'email'])->where('id', 3)->and('username', 'midori'); | ||
$this->assertEquals( | ||
"SELECT id, email FROM users WHERE id='3' AND username='midori'", | ||
"SELECT id, email FROM users WHERE id = '3' AND username = 'midori'", | ||
$this->queryMaker->getQuery() | ||
); | ||
$this->assertEquals( | ||
"SELECT id, email FROM users WHERE id=:id AND username=:username", | ||
"SELECT id, email FROM users WHERE id = :id AND username = :username", | ||
$this->queryMaker->getStatement() | ||
); | ||
} | ||
|
@@ -128,11 +128,11 @@ public function testWhereOr() | |
{ | ||
$this->queryMaker->select('users', ['id', 'email'])->where('id', 3)->or('username', 'midori'); | ||
$this->assertEquals( | ||
"SELECT id, email FROM users WHERE id='3' OR username='midori'", | ||
"SELECT id, email FROM users WHERE id = '3' OR username = 'midori'", | ||
$this->queryMaker->getQuery() | ||
); | ||
$this->assertEquals( | ||
"SELECT id, email FROM users WHERE id=:id OR username=:username", | ||
"SELECT id, email FROM users WHERE id = :id OR username = :username", | ||
$this->queryMaker->getStatement() | ||
); | ||
} | ||
|
@@ -144,11 +144,11 @@ public function testWhereAndOr() | |
3 | ||
)->and('email', '[email protected]')->or('username', 'midori'); | ||
$this->assertEquals( | ||
"SELECT id, email FROM users WHERE id='3' AND email='[email protected]' OR username='midori'", | ||
"SELECT id, email FROM users WHERE id = '3' AND email = '[email protected]' OR username = 'midori'", | ||
$this->queryMaker->getQuery() | ||
); | ||
$this->assertEquals( | ||
"SELECT id, email FROM users WHERE id=:id AND email=:email OR username=:username", | ||
"SELECT id, email FROM users WHERE id = :id AND email = :email OR username = :username", | ||
$this->queryMaker->getStatement() | ||
); | ||
} | ||
|