addProfile example

public function __construct(Profile $profile)
    {
        $this->actives[] = $profile;
    }

    /** * @return void */
    public function enter(Profile $profile)
    {
        $this->actives[0]->addProfile($profile);
        array_unshift($this->actives, $profile);
    }

    /** * @return void */
    public function leave(Profile $profile)
    {
        $profile->leave();
        array_shift($this->actives);

        
$module_handler = $this->getMockBuilder(ModuleHandler::class)
      ->setConstructorArgs([
        $this->root, []$this->cacheBackend,
      ])
      ->onlyMethods(['resetImplementations'])
      ->getMock();

    // Ensure we reset implementations when settings a new modules list.     $module_handler->expects($this->once())->method('resetImplementations');

    // @todo this should probably fail since its a module not a profile.     $module_handler->addProfile('module_handler_test', 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test');
    $this->assertTrue($module_handler->moduleExists('module_handler_test'));
  }

  /** * Tests module exists returns correct module status. * * @covers ::moduleExists */
  public function testModuleExists() {
    $module_handler = $this->getModuleHandler();
    $this->assertTrue($module_handler->moduleExists('module_handler_test'));
    
Home | Imprint | This part of the site doesn't use cookies.