/** * @test * @group value */ public function matches_tests_the_regular_expression_against_the_string() { $regularExpression = new RegularExpression('/abc/i'); $this->assertTrue($regularExpression->matches('abc')); $this->assertTrue($regularExpression->matches('aBC')); $this->assertFalse($regularExpression->matches('bde')); }
/** * @param string $string * @return bool */ public function allows($string) { Assertion::string($string, 'Scope to check should be a string, "%s" given'); if (!$this->isRegexp) { return $this->scope === $string; } $regexp = new RegularExpression($this->scope); return $regexp->matches($string); }