public function VendorHardeningPluginTest::testCleanPathsForPackage in Drupal 9
Same name and namespace in other branches
- 8 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 79
Class
- VendorHardeningPluginTest
- @coversDefaultClass \Drupal\Composer\Plugin\VendorHardening\VendorHardeningPlugin @group VendorHardening
Namespace
Drupal\Tests\Composer\Plugin\VendorHardeningCode
public function testCleanPathsForPackage() {
$plugin = $this
->getMockBuilder(VendorHardeningPlugin::class)
->setMethods([
'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
->setAccessible(TRUE);
$ref_io
->setValue($plugin, $io
->reveal());
$this
->assertFileExists(vfsStream::url('vendor/drupal/package/tests/SomeTest.php'));
$package = $this
->prophesize(PackageInterface::class);
$package
->getName()
->willReturn('drupal/package');
$ref_clean = new \ReflectionMethod($plugin, 'cleanPathsForPackage');
$ref_clean
->setAccessible(TRUE);
$ref_clean
->invokeArgs($plugin, [
$package
->reveal(),
[
'tests',
],
]);
$this
->assertFileDoesNotExist(vfsStream::url('vendor/drupal/package/tests'));
}