equalTo() public static method

public static equalTo ( $value )
Example #1
0
 /**
  * @test
  */
 public function shouldReturnNothingUsingEqualToRestrictionWhenRestrictionDoesNotMatch()
 {
     //given
     Product::create(array('name' => 'tech'));
     //when
     $loadedProduct = Product::where(array('name' => Restrictions::equalTo('te')))->fetch();
     //then
     $this->assertNull($loadedProduct);
 }
 /**
  * @test
  */
 public function shouldCreateProperSql()
 {
     //given
     $restriction = Restrictions::equalTo('value');
     //when
     $sql = $restriction->toSql('key');
     //then
     $this->assertEquals('key = ?', $sql);
     $this->assertEquals(array('value'), $restriction->getValues());
 }
Example #3
0
 /**
  * @test
  */
 public function shouldAcceptRestrictionsMixedWithValuesInWhere()
 {
     //given
     $product = Product::create(array('name' => 'tech', 'description' => 'desc'));
     //when
     $loadedProduct = Product::where(array('name' => Restrictions::equalTo('tech'), 'description' => 'desc'))->fetch();
     //then
     $this->assertEquals($product, $loadedProduct);
 }
Example #4
0
 /**
  * @test
  */
 public function shouldNotAddParenthesisToSingleOfRestriction()
 {
     // when
     $result = WhereClause::create(array('a' => Restrictions::equalTo('b')));
     // then
     $this->assertInstanceOf('\\Ouzo\\Db\\WhereClause\\ArrayWhereClause', $result);
     $this->assertEquals('a = ?', $result->toSql());
 }