public function shouldReturnArrayOfMatchedStates()
{
$a = new State('a');
$b = new State('ab');
$c = new State('ba');
$d = new State('abracadabra');
$e = new State('action-hero');
$f = new State('action-bad-guy');
$g = new State('ac');
$targets = array($a, $b, $c, $d, $e, $f, $g);
$regex = new State('regex:/.*/');
$this->assertEquals($targets, Utils::getAllRegexMatchingStates($regex, $targets));
$regex = new State('regex:/^a.*/');
$this->assertEquals(array($a, $b, $d, $e, $f, $g), Utils::getAllRegexMatchingStates($regex, $targets));
$regex = new State('regex:/^a.+/');
$this->assertEquals(array($b, $d, $e, $f, $g), Utils::getAllRegexMatchingStates($regex, $targets));
$regex = new State('regex:/^a.*a.+$/');
$this->assertEquals(array($d, $f), Utils::getAllRegexMatchingStates($regex, $targets));
$regex = new State('regex:/^ac.*-.+$/');
$this->assertEquals(array($e, $f), Utils::getAllRegexMatchingStates($regex, $targets));
$regex = new State('ac');
$this->assertFalse($regex->isRegex());
$this->assertEquals(array($g), Utils::getAllRegexMatchingStates($regex, $targets), 'non regex state');
}