function VendorHardeningPluginTest::testCleanPathsForPackage

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php \Drupal\Tests\Composer\Plugin\VendorHardening\VendorHardeningPluginTest::testCleanPathsForPackage()
  2. 10 core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php \Drupal\Tests\Composer\Plugin\VendorHardening\VendorHardeningPluginTest::testCleanPathsForPackage()
  3. 11.x 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 65

Class

VendorHardeningPluginTest
@coversDefaultClass \Drupal\Composer\Plugin\VendorHardening\VendorHardeningPlugin @group VendorHardening

Namespace

Drupal\Tests\Composer\Plugin\VendorHardening

Code

public function testCleanPathsForPackage() {
    $plugin = new VendorHardeningPlugin();
    $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'));
    $ref_clean = new \ReflectionMethod($plugin, 'cleanPathsForPackage');
    $ref_clean->setAccessible(TRUE);
    $ref_clean->invokeArgs($plugin, [
        vfsStream::url('vendor'),
        'drupal/package',
        [
            'tests',
        ],
    ]);
    $this->assertFileNotExists(vfsStream::url('vendor/drupal/package/tests'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.