function VendorHardeningPluginTest::testWriteAccessRestrictionFiles
@covers ::writeAccessRestrictionFiles
      
    
File
- 
              core/
tests/ Drupal/ Tests/ Composer/ Plugin/ VendorHardening/ VendorHardeningPluginTest.php, line 151  
Class
- VendorHardeningPluginTest
 - @coversDefaultClass \Drupal\Composer\Plugin\VendorHardening\VendorHardeningPlugin[[api-linebreak]] @group VendorHardening
 
Namespace
Drupal\Tests\Composer\Plugin\VendorHardeningCode
public function testWriteAccessRestrictionFiles() : void {
  $dir = vfsStream::url('vendor');
  // Set up mocks so that writeAccessRestrictionFiles() can eventually use
  // the IOInterface object.
  $composer = $this->getMockBuilder(Composer::class)
    ->onlyMethods([
    'getPackage',
  ])
    ->getMock();
  $composer->expects($this->once())
    ->method('getPackage')
    ->willReturn($this->prophesize(RootPackageInterface::class)
    ->reveal());
  $plugin = new VendorHardeningPlugin();
  $plugin->activate($composer, $this->prophesize(IOInterface::class)
    ->reveal());
  $this->assertDirectoryExists($dir);
  $this->assertFileDoesNotExist($dir . '/.htaccess');
  $this->assertFileDoesNotExist($dir . '/web.config');
  $plugin->writeAccessRestrictionFiles($dir);
  $this->assertFileExists($dir . '/.htaccess');
  $this->assertFileExists($dir . '/web.config');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.