/** * @covers ::initPackageFromExtension * @covers ::getPackageObject */ public function testInitPackageFromInstalledExtension() { $extension = new Extension($this->root, 'module', 'modules/test_module/test_module.info.yml'); $info_parser = $this->prophesize(InfoParserInterface::class); $info_parser->parse($this->root . '/modules/test_module/test_module.info.yml')->willReturn(['name' => 'Test module', 'description' => 'test description', 'type' => 'module']); \Drupal::getContainer()->set('info_parser', $info_parser->reveal()); $bundle = $this->prophesize(FeaturesBundle::class); $bundle->getShortName('test_module')->willReturn('test_module'); $bundle->isDefault()->willReturn(TRUE); $assigner = $this->prophesize(FeaturesAssignerInterface::class); $assigner->findBundle(Argument::cetera())->willReturn($bundle->reveal()); $this->featuresManager->setAssigner($assigner->reveal()); $this->moduleHandler->expects($this->any())->method('moduleExists')->with('test_module')->willReturn(TRUE); $result = $this->featuresManager->initPackageFromExtension($extension); $this->assertEquals(FeaturesManagerInterface::STATUS_INSTALLED, $result->getStatus()); }