sortHelper example


  public function testSortHelper($plugin_id_1$plugin_id_2$expected) {
    $this->setupPluginCollection($this->any());
    if ($expected != 0) {
      $expected = $expected > 0 ? 1 : -1;
    }
    $this->assertEquals($expected$this->defaultPluginCollection->sortHelper($plugin_id_1$plugin_id_2));
  }

  /** * @covers ::getConfiguration */
  public function testGetConfiguration() {
    $this->setupPluginCollection($this->exactly(3));
    // The expected order matches $this->config.     $expected = ['banana', 'cherry', 'apple'];

    $config = $this->defaultPluginCollection->getConfiguration();
    
$a = $this->get($aID);
    $b = $this->get($bID);
    if ($a->status != $b->status) {
      return !empty($a->status) ? -1 : 1;
    }
    if ($a->weight != $b->weight) {
      return $a->weight <=> $b->weight;
    }
    if ($a->provider != $b->provider) {
      return strnatcasecmp($a->provider, $b->provider);
    }
    return parent::sortHelper($aID$bID);
  }

  /** * {@inheritdoc} */
  public function getConfiguration() {
    $configuration = parent::getConfiguration();
    // Remove configuration if it matches the defaults. In self::getAll(), we     // load all available filters, in addition to the enabled filters stored in     // configuration. In order to prevent those from bleeding through to the     // stored configuration, remove all filters that match the default values.
Home | Imprint | This part of the site doesn't use cookies.