MockController example

$class_resolver->setContainer($this->container);
    $this->httpMessageFactory = new PsrHttpFactory(new HttpFactory()new HttpFactory()new HttpFactory()new HttpFactory());
    $this->controllerResolver = new ControllerResolver($this->httpMessageFactory, $class_resolver);
  }

  /** * Tests createController(). * * @dataProvider providerTestCreateController */
  public function testCreateController($controller$class$output) {
    $this->container->set('some_service', new MockController());
    $result = $this->controllerResolver->getControllerFromDefinition($controller);
    $this->assertCallableController($result$class$output);
  }

  /** * Provides test data for testCreateController(). */
  public function providerTestCreateController() {
    return [
      // Tests class::method.       ['Drupal\Tests\Core\Controller\MockController::getResult', 'Drupal\Tests\Core\Controller\MockController', 'This is a regular controller.'],
      
Home | Imprint | This part of the site doesn't use cookies.