umask() 공개 정적인 메소드

If no value is given only the current umask setting is returned.
부터: 0.8.0
public static umask ( integer $umask = null ) : integer
$umask integer new umask setting
리턴 integer
예제 #1
0
 /**
  * Sets up the required fixtures.
  */
 public function setUp()
 {
     $mockConfig = ['ClassContent' => [], 'Config' => ['bootstrap.yml' => file_get_contents(__DIR__ . '/Config/bootstrap.yml'), 'bundles.yml' => file_get_contents(__DIR__ . '/Config/bundles.yml'), 'config.yml' => file_get_contents(__DIR__ . '/Config/config.yml'), 'doctrine.yml' => file_get_contents(__DIR__ . '/Config/doctrine.yml'), 'logging.yml' => file_get_contents(__DIR__ . '/Config/logging.yml'), 'security.yml' => file_get_contents(__DIR__ . '/Config/security.yml'), 'services.yml' => file_get_contents(__DIR__ . '/Config/services.yml')], 'Ressources' => [], 'cache' => ['Proxies' => [], 'twig' => []]];
     vfsStream::umask(00);
     vfsStream::setup('repositorydir', 0777, $mockConfig);
     $mockApp = new MockBBApplication(null, null, false, $mockConfig, __DIR__ . '/../vendor');
     $this->bundle = $mockApp->getBundle('theme');
 }
    /**
     * @covers ::execute
     */
    public function testExecute()
    {
        // mock the Kernel or create one depending on your needs
        $application = new Console(self::$app);
        $application->add(new AclLoadCommand());
        $command = $application->find('acl:load');
        $commandTester = new CommandTester($command);
        vfsStream::umask(00);
        $this->_mock_basedir = vfsStream::setup('test_dir', 0777, array('file.yml' => '
groups:
  super_admin:
    sites:
      resources: all
      actions: all
            '));
        $commandTester->execute(array('command' => $command->getName(), 'file' => 'vfs://test_dir/file.yml'));
        $this->assertContains('Processing file: vfs://test_dir/file.yml', $commandTester->getDisplay());
    }
예제 #3
0
 public function testOnApplicationInitRaisesContainerDirectoryNotWritableException()
 {
     $basic_services_yml = array('parameters' => array('bbapp.logger.class' => 'BackBee\\Logging\\Logger', 'bbapp.logger_debug.class' => 'BackBee\\Logging\\DebugStackLogger'));
     $bootstrap_yml = array('debug' => false, 'container' => array('dump_directory' => 'vfs://no_rights_base_directory/container', 'autogenerate' => true));
     $resources_directory = realpath(__DIR__ . '/../ContainerBuilderTest_Ressources/');
     $virtual_structure = array('backbee' => array('Config' => array('services' => array('services.yml' => \Symfony\Component\Yaml\Yaml::dump($basic_services_yml)))), 'repository' => array('Config' => array('bootstrap.yml' => \Symfony\Component\Yaml\Yaml::dump($bootstrap_yml))), 'container' => array());
     vfsStream::umask(0222);
     vfsStream::setup('cant_write_base_directory', 0777, $virtual_structure);
     $application = $this->generateManualBBApplication(vfsStream::url('cant_write_base_directory'));
     $application->setContainer((new ContainerBuilder($application))->getContainer());
     $container = $application->getContainer();
     $application->setDebug_Mode(false);
     $container->setParameter('container.dump_directory', $application->getBaseDir() . '/container');
     $this->assertFalse($container->isFrozen());
     $event = new Event($application);
     try {
         ContainerListener::onApplicationInit($event);
         $this->fail('Raise of ContainerDirectoryNotWritableException expected.');
     } catch (\Exception $e) {
         $this->assertInstanceOf('BackBee\\DependencyInjection\\Exception\\ContainerDirectoryNotWritableException', $e);
     }
 }
예제 #4
0
 protected function createFilesystem()
 {
     vfsStream::umask(00);
     $filesystem = vfsStream::setup('tmp', null, ['upload' => ['test.txt' => 'Lorem ipsum dolor sit amet']]);
     return $filesystem;
 }
예제 #5
0
 public function resetStructure()
 {
     if (null !== $this->mockedStructure) {
         vfsStream::umask(00);
         vfsStream::setup('repositorydir', 0777, $this->mockedStructure);
     }
 }
예제 #6
0
 /**
  * Creates a virtual file system
  *
  * @param array  $structure A nested array keyed by folder or filename;
  *                           array values for sub-directories
  * @param string $baseDir   The name of the base directory
  * @param int    $umask     Umask setting for the virtual file system
  *
  * @return vfsStreamDirectory
  */
 protected function createVfs(array $structure, $baseDir = 'root', $umask = 022)
 {
     vfsStream::umask($umask);
     return vfsStream::setup($baseDir, null, $structure);
 }