Exemplo n.º 1
0
 public function testDelete()
 {
     $statement = $this->getStatementBuilder();
     $statement->delete('people', Condition::equals('id', 1));
     $this->assertSame($statement->queries, ['delete from people where id = ?']);
     $this->assertSame($statement->bindings, [1]);
 }
Exemplo n.º 2
0
 public function testEquals()
 {
     $condition = Condition::equals('age', 51);
     $this->assertSame($condition->getLeft(), 'age');
     $this->assertFalse($condition->shouldEscapeLeft());
     $this->assertSame($condition->getOperator(), '=');
     $this->assertSame($condition->getRight(), 51);
     $this->assertTrue($condition->shouldEscapeRight());
 }
Exemplo n.º 3
0
 public function testHasWithNoResults()
 {
     $db = $this->buildDatabase();
     $condition = Condition::equals('last_name', 'Bob');
     $entry = $db->has('presidents', $condition);
     $this->assertFalse($entry);
 }
Exemplo n.º 4
0
 public function testHasSomethingNonExistent()
 {
     $db = $this->buildDatabase();
     $this->assertFalse($db->has('test', Condition::equals('last_name', 'Lincoln2')));
 }