writeWebConfig example


  public function writeAccessRestrictionFiles($vendor_dir) {
    $this->io->writeError('<info>Hardening vendor directory with .htaccess and web.config files.</info>');
    // Prevent access to vendor directory on Apache servers.     FileSecurity::writeHtaccess($vendor_dir, TRUE);

    // Prevent access to vendor directory on IIS servers.     FileSecurity::writeWebConfig($vendor_dir);
  }

}

  public function testWriteHtaccessFailure() {
    vfsStream::setup('root');
    $this->assertFalse(FileSecurity::writeHtaccess(vfsStream::url('root') . '/foo'));
  }

  /** * @covers ::writeWebConfig */
  public function testWriteWebConfig() {
    vfsStream::setup('root');
    $this->assertTrue(FileSecurity::writeWebConfig(vfsStream::url('root')));
    $web_config_file = vfsStream::url('root') . '/web.config';
    $this->assertFileExists($web_config_file);
    $this->assertEquals('0444', substr(sprintf('%o', fileperms($web_config_file)), -4));
  }

  /** * @covers ::writeWebConfig */
  public function testWriteWebConfigForceOverwrite() {
    vfsStream::setup('root');
    $web_config_file = vfsStream::url('root') . '/web.config';
    
Home | Imprint | This part of the site doesn't use cookies.