/** * @see \Drupal\page_manager\Plugin\VariantAwareInterface::getVariants() */ public function getVariants() { if (!$this->variantCollection) { $this->variantCollection = new VariantCollection(\Drupal::service('plugin.manager.display_variant'), $this->getVariantConfig()); $this->variantCollection->sort(); } return $this->variantCollection; }
/** * @covers ::getVariants * * @depends testGetVariants */ public function testGetVariantsSort(VariantCollection $variants) { $this->assertSame(['bar' => 'bar', 'foo' => 'foo'], $variants->getInstanceIds()); }