-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
261 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace spec\GrumPHP\Util; | ||
|
||
use PhpSpec\ObjectBehavior; | ||
use Prophecy\Argument; | ||
|
||
class RegexSpec extends ObjectBehavior | ||
{ | ||
|
||
function it_will_handle_regex_input() | ||
{ | ||
$this->beConstructedWith('#test#'); | ||
$this->__toString()->shouldBe('#test#'); | ||
} | ||
|
||
function it_will_handle_glob_input() | ||
{ | ||
$this->beConstructedWith('test'); | ||
$this->__toString()->shouldBe('#^(?=[^\.])test$#'); | ||
} | ||
|
||
function it_should_be_able_to_add_pattern_modifier_when_no_modifiers_are_available() | ||
{ | ||
$this->beConstructedWith('#test#'); | ||
$this->addPatternModifier('m'); | ||
|
||
$this->__toString()->shouldBe('#test#m'); | ||
} | ||
|
||
function it_should_be_able_to_add_pattern_modifier_when__modifiers_are_available() | ||
{ | ||
$this->beConstructedWith('#test#i'); | ||
$this->addPatternModifier('m'); | ||
|
||
$this->__toString()->shouldBe('#test#im'); | ||
} | ||
|
||
function it_should_not_add_pattern_modifier_twice() | ||
{ | ||
$this->beConstructedWith('#test#i'); | ||
$this->addPatternModifier('i'); | ||
|
||
$this->__toString()->shouldBe('#test#i'); | ||
} | ||
|
||
function it_should_know_which_pattern_modifiers_can_be_user() | ||
{ | ||
$this->beConstructedWith('#test#i'); | ||
$this->shouldThrow('RuntimeException')->duringAddPatternModifier('invalid'); | ||
$this->shouldThrow('RuntimeException')->duringAddPatternModifier('a'); | ||
} | ||
} |
Oops, something went wrong.