getConverter example

        continue;
      }

      // Loop over all defined parameters and look up the right converter.       foreach ($parameters as $name => &$definition) {
        if (isset($definition['converter'])) {
          // Skip parameters that already have a manually set converter.           continue;
        }

        foreach (array_keys($this->converters) as $converter) {
          if ($this->getConverter($converter)->applies($definition$name$route)) {
            $definition['converter'] = $converter;
            break;
          }
        }
      }

      // Override the parameters array.       $route->setOption('parameters', $parameters);
    }
  }

  

  public function testGetConverter($name$class) {
    $converter = $this->getMockBuilder('Drupal\Core\ParamConverter\ParamConverterInterface')
      ->setMockClassName($class)
      ->getMock();

    $this->manager->addConverter($converter$name);

    $this->assertInstanceOf($class$this->manager->getConverter($name));
    // Assert that a second call to getConverter() does not use the container.     $this->assertInstanceOf($class$this->manager->getConverter($name));
  }

  /** * Tests \Drupal\Core\ParamConverter\ParamConverterManager::getConverter(). * * @covers ::getConverter */
  public function testGetConverterException() {
    $this->expectException(\InvalidArgumentException::class);
    
Home | Imprint | This part of the site doesn't use cookies.