directory() public static method

Assert that a directory exists
public static directory ( string $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value string
$message string | null
$propertyPath string | null
return boolean
Exemplo n.º 1
0
 /**
  * @param string $filename
  */
 public function setFilename($filename)
 {
     Assertion::string($filename, 'Invalid filename.');
     Assertion::directory(dirname($filename), 'The selected directory does not exist.');
     Assertion::writeable(dirname($filename), 'The selected directory is not writable.');
     $this->filename = $filename;
 }
 public function __construct($directory)
 {
     Assertion::directory($directory);
     Assertion::readable($directory);
     $directory .= substr($directory, -1) === '/' ? '' : '/';
     //add ending slash
     $this->directory = $directory;
 }
Exemplo n.º 3
0
 public function testDirectory()
 {
     Assertion::directory(__DIR__);
     $this->setExpectedException('Assert\\AssertionFailedException', null, Assertion::INVALID_DIRECTORY);
     Assertion::directory(__DIR__ . '/does-not-exist');
 }
Exemplo n.º 4
0
 /**
  * Sets the project directory.
  *
  * @param string $projectDirectory
  *
  * @return $this
  */
 public function setProjectDirectory($projectDirectory)
 {
     Assertion::directory($projectDirectory);
     $this->projectDirectory = $projectDirectory;
     return $this;
 }
Exemplo n.º 5
0
 /**
  * __construct()
  *
  * @param ConfigLoader $configLoader Config loader
  * @param string       $path         Config files path
  */
 public function __construct(ConfigLoader $configLoader, $path)
 {
     Assertion::directory($path);
     $this->path = $path;
     $this->configLoader = $configLoader;
 }
 /**
  * @Given /^I specify the path "([^"]*)"$/
  */
 public function iSpecifyThePath($arg1)
 {
     $this->path = $arg1;
     Assertion::directory(getcwd() . '/' . $this->path);
 }