Add tests for git

This commit is contained in:
Dennis Eichhorn 2017-11-17 17:19:21 +01:00
parent 536906ed46
commit e6597256a0
5 changed files with 9 additions and 12 deletions

View File

@ -67,6 +67,6 @@ class Branch
*/
public function setName(string $name) /* : void */
{
$this->name = escapeshellarg($name);
$this->name = $name;
}
}

View File

@ -103,6 +103,7 @@ class Commit
$this->author = new Author();
$this->branch = new Branch();
$this->tag = new Tag();
$this->repository = new Repository(realpath(__DIR__ . '/../../../../../'));
}
/**

View File

@ -25,6 +25,7 @@ use phpOMS\System\File\PathException;
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
* @codeCoverageIgnore
*/
class Git
{

View File

@ -71,7 +71,6 @@ class Repository
public function __construct(string $path)
{
$this->setPath($path);
$this->branch = $this->getActiveBranch();
}
/**
@ -115,15 +114,11 @@ class Repository
*/
public function getActiveBranch() : Branch
{
if (!isset($this->branch)) {
$branches = $this->getBranches();
$active = preg_grep('/^\*/', $branches);
reset($active);
$branches = $this->getBranches();
$active = preg_grep('/^\*/', $branches);
reset($active);
$this->branch = new Branch(current($active));
}
return $this->branch;
return new Branch(current($active));
}
/**

View File

@ -51,7 +51,7 @@ class Tag
*/
public function __construct(string $name = '')
{
$this->name = escapeshellarg($name);
$this->name = $name;
}
/**
@ -75,7 +75,7 @@ class Tag
*/
public function setMessage(string $message) /* : void */
{
$this->message = escapeshellarg($message);
$this->message = $message;
}
/**