Skip to content

Commit

Permalink
Adjusted tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmcrae committed Nov 20, 2024
1 parent 09dda29 commit cd52b10
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
10 changes: 9 additions & 1 deletion tests/MysqlTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,15 @@ public function testNotConditions()
{
$table = $this->db->table('test');

$this->assertEquals('SELECT * FROM `test` WHERE NOT (`a` = ? OR `b` = ?)', $table->beginNot()->eq('a', 1)->eq('b', 2)->closeNot()->buildSelectQuery());
$this->assertEquals('SELECT * FROM `test` WHERE NOT (`a` = ? AND `b` = ?)', $table->beginNot()->eq('a', 1)->eq('b', 2)->closeNot()->buildSelectQuery());
$this->assertEquals(array(2), $table->getConditionBuilder()->getValues());
}

public function testNotEmbeddedConditions()
{
$table = $this->db->table('test');

$this->assertEquals('SELECT * FROM `test` WHERE NOT (`a` = ? OR `b` = ?)', $table->beginNot()->beginOr()->eq('a', 1)->eq('b', 2)->closeOr()->closeNot()->buildSelectQuery());
$this->assertEquals(array(2), $table->getConditionBuilder()->getValues());
}

Expand Down
10 changes: 9 additions & 1 deletion tests/PostgresTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,15 @@ public function testNotConditions()
{
$table = $this->db->table('test');

$this->assertEquals('SELECT * FROM `test` WHERE NOT (`a` = ? OR `b` = ?)', $table->beginNot()->eq('a', 1)->eq('b', 2)->closeNot()->buildSelectQuery());
$this->assertEquals('SELECT * FROM `test` WHERE NOT (`a` = ? AND `b` = ?)', $table->beginNot()->eq('a', 1)->eq('b', 2)->closeNot()->buildSelectQuery());
$this->assertEquals(array(2), $table->getConditionBuilder()->getValues());
}

public function testNotEmbeddedConditions()
{
$table = $this->db->table('test');

$this->assertEquals('SELECT * FROM `test` WHERE NOT (`a` = ? OR `b` = ?)', $table->beginNot()->beginOr()->eq('a', 1)->eq('b', 2)->closeOr()->closeNot()->buildSelectQuery());
$this->assertEquals(array(2), $table->getConditionBuilder()->getValues());
}

Expand Down
10 changes: 9 additions & 1 deletion tests/SqliteTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,15 @@ public function testNotConditions()
{
$table = $this->db->table('test');

$this->assertEquals('SELECT * FROM `test` WHERE NOT (`a` = ? OR `b` = ?)', $table->beginNot()->eq('a', 1)->eq('b', 2)->closeNot()->buildSelectQuery());
$this->assertEquals('SELECT * FROM `test` WHERE NOT (`a` = ? AND `b` = ?)', $table->beginNot()->eq('a', 1)->eq('b', 2)->closeNot()->buildSelectQuery());
$this->assertEquals(array(2), $table->getConditionBuilder()->getValues());
}

public function testNotEmbeddedConditions()
{
$table = $this->db->table('test');

$this->assertEquals('SELECT * FROM `test` WHERE NOT (`a` = ? OR `b` = ?)', $table->beginNot()->beginOr()->eq('a', 1)->eq('b', 2)->closeOr()->closeNot()->buildSelectQuery());
$this->assertEquals(array(2), $table->getConditionBuilder()->getValues());
}

Expand Down

0 comments on commit cd52b10

Please sign in to comment.