function it_searches_matchers_by_their_priority(Matcher $matcher1, Matcher $matcher2) { $matcher1->getPriority()->willReturn(2); $matcher1->supports('startWith', 'hello, world', array('hello'))->willReturn(true); $matcher2->getPriority()->willReturn(5); $matcher2->supports('startWith', 'hello, world', array('hello'))->willReturn(true); $this->add($matcher1); $this->add($matcher2); $this->find('startWith', 'hello, world', array('hello'))->shouldReturn($matcher2); }