public function testFailedCall() { $binary = new Binary(SVN_BINARY); $call = $binary->createCall('/', 'unknowncommand', array()); $result = $call->execute(); $this->assertFalse($result->hasStdOut()); $this->assertTrue($result->hasStdErr()); $this->assertEmpty($result->getStdOut()); $this->assertNotEmpty($result->getStdErr()); $this->assertGreaterThan(0, $result->getReturnCode()); }
/** * Registers the stream wrapper with the given protocol * * @param string $protocol The protocol (such as "svn") * @param Binary|string|null|PathFactoryInterface $binary The SVN binary or a path factory * @throws \RuntimeException If $protocol is already registered */ public static function register($protocol, $binary = null) { $bufferFactory = Factory::getDefault(); if ($binary instanceof PathFactoryInterface) { $pathFactory = $binary; } else { $binary = Binary::ensure($binary); $pathFactory = new PathFactory($protocol, $binary, null); } parent::doRegister($protocol, $pathFactory, $bufferFactory); }
/** * Opens a SVN repository on the file system * * @param string $repositoryPath The full path to the repository * @param Binary|string|null $svn The SVN binary * @return Repository * @throws \RuntimeException If the path cannot be created * @throws \InvalidArgumentException If the path is not valid or if it's not a valid SVN repository */ public static function open($repositoryPath, $svn = null) { $svn = Binary::ensure($svn); if (!is_string($repositoryPath)) { throw new \InvalidArgumentException(sprintf('"%s" is not a valid path', $repositoryPath)); } $repositoryRoot = self::findRepositoryRoot($svn, $repositoryPath); if ($repositoryRoot === null) { throw new \InvalidArgumentException(sprintf('"%s" is not a valid SVN repository', $repositoryPath)); } return new static($repositoryRoot, $svn); }
/** * Creates a path factory * * @param string $protocol The protocol (such as "svn") * @param Binary|string|null $svn The SVN binary * @param RepositoryRegistry $map The repository registry */ public function __construct($protocol, $svn = null, RepositoryRegistry $map = null) { parent::__construct($protocol, $map); $this->svn = Binary::ensure($svn); }