/** * Creates shared files and folders */ protected function prepareSharedFilesAndFolders(Context $context) { $basepath = $this->transporter->getPath(); $sharedPath = $basepath . '/shared'; $shared = (array) $this->options['shared']; // add some white space to the output if (count($shared) > 0) { $this->io->write(''); } foreach ($shared as $fileOrFolder) { $sharedFilepath = $sharedPath . '/' . $fileOrFolder; $localFilepath = $context->getBuilddir() . '/' . $fileOrFolder; if (false === $this->transporter->exists($sharedFilepath)) { // Hmm, the shared entity doesn't exist // is it a directory? if (is_dir($localFilepath) || '/' === substr($sharedFilepath, -1)) { $this->transporter->mkdir($sharedFilepath); } else { $parentDir = dirname($sharedFilepath); if (false === $this->transporter->exists($parentDir) && $parentDir != $sharedPath) { $this->transporter->mkdir($parentDir); } $this->transporter->putContent('', $sharedFilepath); // make a dummy file } } } }
public function testMkdirDispatchesEvent() { $this->getDispatcherMock()->expects($this->once())->method('dispatch')->with(TransporterEvents::TRANSPORTER_MKDIR, $this->anything()); $this->transporter->mkdir($this->transporter->getPath() . '/deploy'); }