public function FeaturesManagerTest::testInitPackageFromInstalledExtension in Features 8.3
Same name and namespace in other branches
- 8.4 tests/src/Unit/FeaturesManagerTest.php \Drupal\Tests\features\Unit\FeaturesManagerTest::testInitPackageFromInstalledExtension()
@covers ::initPackageFromExtension @covers ::getPackageObject
File
- tests/
src/ Unit/ FeaturesManagerTest.php, line 731
Class
- FeaturesManagerTest
- @coversDefaultClass Drupal\features\FeaturesManager @group features
Namespace
Drupal\Tests\features\UnitCode
public function testInitPackageFromInstalledExtension() {
$this
->setupVfsWithTestFeature();
$extension = new Extension('vfs://drupal', 'module', 'modules/test_feature/test_feature.info.yml');
$bundle = $this
->prophesize(FeaturesBundle::class);
$bundle
->getFullName('test_feature')
->willReturn('test_feature');
$bundle
->isDefault()
->willReturn(TRUE);
$assigner = $this
->prophesize(FeaturesAssignerInterface::class);
$assigner
->findBundle(Argument::cetera())
->willReturn($bundle
->reveal());
$this->featuresManager
->setRoot('vfs://drupal');
$this->featuresManager
->setAssigner($assigner
->reveal());
$this->moduleHandler
->expects($this
->any())
->method('moduleExists')
->with('test_feature')
->willReturn(TRUE);
$result = $this->featuresManager
->initPackageFromExtension($extension);
$this
->assertEquals(FeaturesManagerInterface::STATUS_INSTALLED, $result
->getStatus());
}