public function FeaturesGenerateTest::testGeneratorWithBundle in Features 8.3
Same name and namespace in other branches
- 8.4 tests/src/Kernel/FeaturesGenerateTest.php \Drupal\Tests\features\Kernel\FeaturesGenerateTest::testGeneratorWithBundle()
File
- tests/
src/ Kernel/ FeaturesGenerateTest.php, line 104
Class
- FeaturesGenerateTest
- @group features
Namespace
Drupal\Tests\features\KernelCode
public function testGeneratorWithBundle() {
$filename = $this->fileSystem
->getTempDirectory() . '/' . self::BUNDLE_NAME . '_' . self::PACKAGE_NAME . '.tar.gz';
if (file_exists($filename)) {
unlink($filename);
}
$this
->assertFalse(file_exists($filename), 'Archive file already exists.');
$bundle = FeaturesBundle::create([
'machine_name' => self::BUNDLE_NAME,
]);
$this->generator
->generatePackages('archive', $bundle, [
self::PACKAGE_NAME,
]);
$package = $this->featuresManager
->getPackage(self::PACKAGE_NAME);
$this
->assertNull($package);
$package = $this->featuresManager
->getPackage(self::BUNDLE_NAME . '_' . self::PACKAGE_NAME);
$this
->assertEquals(self::BUNDLE_NAME . '_' . self::PACKAGE_NAME, $package
->getMachineName());
$this
->assertEquals(self::BUNDLE_NAME, $package
->getBundle());
$this
->assertTrue(file_exists($filename), 'Archive file was not generated.');
}