public function testIndexedSorting() { /** @var SortingInterface[] $sortings */ $sortings = array(new PriceSorting(), new ProductNameSorting(), new PopularitySorting()); $criteria = new Criteria(); foreach ($sortings as $sort) { $criteria->addSorting($sort); } foreach ($sortings as $expected) { $sorting = $criteria->getSorting($expected->getName()); $this->assertEquals($expected, $sorting); } }