spec\Sylius\Bundle\UiBundle\Twig\SortByExtensionSpec::it_sorts_an_array_of_objects_by_a_nested_property PHP Метод

it_sorts_an_array_of_objects_by_a_nested_property() публичный Метод

public it_sorts_an_array_of_objects_by_a_nested_property ( Sylius\Bundle\UiBundle\spec\Fixtures\SampleInterface $firstSample, Sylius\Bundle\UiBundle\spec\Fixtures\SampleInterface $secondSample, Sylius\Bundle\UiBundle\spec\Fixtures\SampleInterface $thirdSample, Sylius\Bundle\UiBundle\spec\Fixtures\SampleInterface $firstInnerSample, Sylius\Bundle\UiBundle\spec\Fixtures\SampleInterface $secondInnerSample, Sylius\Bundle\UiBundle\spec\Fixtures\SampleInterface $thirdInnerSample )
$firstSample Sylius\Bundle\UiBundle\spec\Fixtures\SampleInterface
$secondSample Sylius\Bundle\UiBundle\spec\Fixtures\SampleInterface
$thirdSample Sylius\Bundle\UiBundle\spec\Fixtures\SampleInterface
$firstInnerSample Sylius\Bundle\UiBundle\spec\Fixtures\SampleInterface
$secondInnerSample Sylius\Bundle\UiBundle\spec\Fixtures\SampleInterface
$thirdInnerSample Sylius\Bundle\UiBundle\spec\Fixtures\SampleInterface
    function it_sorts_an_array_of_objects_by_a_nested_property(SampleInterface $firstSample, SampleInterface $secondSample, SampleInterface $thirdSample, SampleInterface $firstInnerSample, SampleInterface $secondInnerSample, SampleInterface $thirdInnerSample)
    {
        $firstInnerSample->getString()->willReturn('m');
        $secondInnerSample->getString()->willReturn('Z');
        $thirdInnerSample->getString()->willReturn('A');
        $firstSample->getInnerSample()->willReturn($firstInnerSample);
        $secondSample->getInnerSample()->willReturn($secondInnerSample);
        $thirdSample->getInnerSample()->willReturn($thirdInnerSample);
        $arrayBeforeSorting = [$firstSample, $secondSample, $thirdSample];
        $this->sortBy($arrayBeforeSorting, 'innerSample.string', 'ASC')->shouldReturn([$thirdSample, $firstSample, $secondSample]);
    }