regexp() public static method

public static regexp ( $value )
Example #1
0
 /**
  * @test
  */
 public function shouldCreateProperSqlForSqlite()
 {
     //given
     Config::overrideProperty('sql_dialect')->with('\\Ouzo\\Db\\Dialect\\Sqlite3Dialect');
     $restriction = Restrictions::regexp('value');
     //when
     $sql = $restriction->toSql('key');
     //then
     $this->assertEquals('key REGEXP ?', $sql);
     $this->assertEquals(array('value'), $restriction->getValues());
 }
Example #2
0
 /**
  * @group non-sqlite3
  * @test
  */
 public function shouldReturnModelUsingRegexpRestriction()
 {
     //given
     $product = Product::create(array('name' => 'name1', 'description' => 'desc'));
     Product::create(array('name' => 'other product', 'description' => 'desc'));
     //when
     $loadedProduct = Product::where(array('name' => Restrictions::regexp('ame')))->fetch();
     //then
     Assert::thatModel($loadedProduct)->isEqualTo($product);
 }