function VendorHardeningPluginTest::testCleanPathsForPackage
Same name in other branches
- 9 core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php \Drupal\Tests\Composer\Plugin\VendorHardening\VendorHardeningPluginTest::testCleanPathsForPackage()
- 8.9.x core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php \Drupal\Tests\Composer\Plugin\VendorHardening\VendorHardeningPluginTest::testCleanPathsForPackage()
- 10 core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php \Drupal\Tests\Composer\Plugin\VendorHardening\VendorHardeningPluginTest::testCleanPathsForPackage()
@covers ::cleanPathsForPackage
File
-
core/
tests/ Drupal/ Tests/ Composer/ Plugin/ VendorHardening/ VendorHardeningPluginTest.php, line 81
Class
- VendorHardeningPluginTest
- @coversDefaultClass \Drupal\Composer\Plugin\VendorHardening\VendorHardeningPlugin @group VendorHardening
Namespace
Drupal\Tests\Composer\Plugin\VendorHardeningCode
public function testCleanPathsForPackage() : void {
$plugin = $this->getMockBuilder(VendorHardeningPlugin::class)
->onlyMethods([
'getInstallPathForPackage',
])
->getMock();
$plugin->expects($this->once())
->method('getInstallPathForPackage')
->willReturn(vfsStream::url('vendor/drupal/package'));
$io = $this->prophesize(IOInterface::class);
$ref_io = new \ReflectionProperty($plugin, 'io');
$ref_io->setValue($plugin, $io->reveal());
$this->assertFileExists(vfsStream::url('vendor/drupal/package/tests/SomeTest.php'));
$this->assertFileExists(vfsStream::url('vendor/drupal/package/SomeFile.php'));
$package = $this->prophesize(PackageInterface::class);
$package->getName()
->willReturn('drupal/package');
$ref_clean = new \ReflectionMethod($plugin, 'cleanPathsForPackage');
$ref_clean->invokeArgs($plugin, [
$package->reveal(),
[
'tests',
'SomeFile.php',
],
]);
$this->assertFileDoesNotExist(vfsStream::url('vendor/drupal/package/tests'));
$this->assertFileDoesNotExist(vfsStream::url('vendor/drupal/package/SomeFile.php'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.