AssetManagerTest\Service\AggregateResolverTest::testCollectWithCollectMethod PHP Method

testCollectWithCollectMethod() public method

    public function testCollectWithCollectMethod()
    {
        $resolver = new AggregateResolver();
        $lowPriority = $this->getMock(ResolverInterface::class, array('resolve', 'collect'));
        $lowPriority->expects($this->exactly(2))->method('collect')->will($this->returnValue(array('one', 'two')));
        $resolver->attach($lowPriority);
        $this->assertContains('one', $resolver->collect());
        $highPriority = $this->getMock(ResolverInterface::class, array('resolve', 'collect'));
        $highPriority->expects($this->once())->method('collect')->will($this->returnValue(array('three')));
        $resolver->attach($highPriority, 1000);
        $collection = $resolver->collect();
        $this->assertContains('one', $collection);
        $this->assertContains('three', $collection);
        $this->assertCount(3, $collection);
    }