Skip to content

Commit

Permalink
Added static calls
Browse files Browse the repository at this point in the history
  • Loading branch information
siad007 committed Aug 6, 2014
1 parent 7475a22 commit 532b3c2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ composer.phar
box.phar
phpunit.xml
test.php
composer.lock
composer.lock
.pydevproject
30 changes: 30 additions & 0 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,36 @@ public static function getInstance($command, $options = array())
return new $commandClassName($options);
}

/**
* @param array $options
*
* @return \Siad007\VersionControl\HG\Command\CloneCommand
*/
public static function createClone($options = array())
{
return self::getInstance('clone', $options);
}

/**
* @param array $options
*
* @return \Siad007\VersionControl\HG\Command\HeadsCommand
*/
public static function createHeads($options = array())
{
return self::getInstance('heads', $options);
}

/**
* @param array $options
*
* @return \Siad007\VersionControl\HG\Command\InitCommand
*/
public static function createInit($options = array())
{
return self::getInstance('init', $options);
}

/**
* Disabled clone behavior.
*/
Expand Down
6 changes: 2 additions & 4 deletions tests/Command/CloneCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class CloneCommandTest extends \PHPUnit_Framework_TestCase
*/
public function cloneCommand()
{
/* @var $cloneCmd \Siad007\VersionControl\HG\Command\CloneCommand */
$cloneCmd = Factory::getInstance('clone');
$cloneCmd = Factory::createClone();
$cloneCmd->setSource('C:\\xampp\\source');
$cloneCmd->setDestination('C:\\xampp\\dest');
$cloneCmd->setUncompressed(true);
Expand All @@ -32,8 +31,7 @@ public function cloneCommand()
*/
public function cloneCommandWithoutDestination()
{
/* @var $cloneCmd \Siad007\VersionControl\HG\Command\CloneCommand */
$cloneCmd = Factory::getInstance('clone');
$cloneCmd = Factory::createClone();
$cloneCmd->setSource('C:\\xampp\\source');
$cloneCmd->setUncompressed(true);
$cloneCmd->setInsecure(true);
Expand Down
3 changes: 1 addition & 2 deletions tests/Command/HeadsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class HeadsCommandTest extends \PHPUnit_Framework_TestCase
*/
public function headsCommand()
{
/* @var $headsCmd \Siad007\VersionControl\HG\Command\HeadsCommand */
$headsCmd = Factory::getInstance('heads');
$headsCmd = Factory::createHeads();
$headsCmd->setTemplate('template');
$headsCmd->setClosed(true);
$headsCmd->setRev('startrev');
Expand Down
3 changes: 1 addition & 2 deletions tests/Command/InitCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class InitCommandTest extends \PHPUnit_Framework_TestCase
*/
public function initCommand()
{
/* @var $initCmd \Siad007\VersionControl\HG\Command\InitCommand */
$initCmd = Factory::getInstance('init');
$initCmd = Factory::createInit();
$initCmd->setDestination('C:\\xampp\\dest\\');
$initCmd->setSsh('testSSH');
$initCmd->setInsecure(true);
Expand Down

0 comments on commit 532b3c2

Please sign in to comment.