function it_return_negative_analyse_occurrences(IncrementationInterface $incrementation, DynamicCapabilitiesProcessorInterface $dynamicCapabilitiesProcessor, OccurrencesInterface $occurences, OccurrenceInterface $occurence1, OccurrenceInterface $occurence2, RuleInterface $rule) { $this->beConstructedWith($incrementation, $dynamicCapabilitiesProcessor); $rule->getConditions()->shouldBeCalled()->willReturn(array(1, 2, 3)); $occurence1->getRule()->shouldBeCalled()->willReturn($rule); $occurence2->getRule()->shouldBeCalled()->willReturn($rule); $dynamicCapabilitiesProcessor->process(Argument::exact($occurence1->getWrappedObject()))->shouldBeCalled(); $dynamicCapabilitiesProcessor->process(Argument::exact($occurence2->getWrappedObject()))->shouldBeCalled(); $occurencesIterator = array($occurence1, $occurence2); $occurences->getFirstOccurrences()->shouldBeCalled()->willReturn($occurencesIterator); $occurences->getNext(Argument::exact($occurence1->getWrappedObject()))->shouldBeCalled()->willReturn($occurence2); $occurences->getNext(Argument::exact($occurence2->getWrappedObject()))->shouldBeCalled()->willReturn(false); $incrementation->oughtToBeIncrement($occurence2->getWrappedObject(), $occurence1->getWrappedObject())->shouldBeCalled()->willReturn(true); $results = $this->analyse($occurences); $results->shouldBeAnInstanceOf('\\Iterator'); $results->shouldHaveCount(0); }