/** * @test */ public function shouldCreateProperSql() { //given $restriction = Restrictions::lessThan(5); //when $sql = $restriction->toSql('key'); //then $this->assertEquals('key < ?', $sql); $this->assertEquals(array(5), $restriction->getValues()); }
/** * @test */ public function shouldAddParenthesisToListOfRestrictions() { // when $result = WhereClause::create(array('a' => array(Restrictions::equalTo('b'), Restrictions::lessThan('c')), 'b' => 'd')); // then $this->assertInstanceOf('\\Ouzo\\Db\\WhereClause\\ArrayWhereClause', $result); $this->assertEquals('(a = ? OR a < ?) AND b = ?', $result->toSql()); }