Enforce "en" lang in tests.
Some tests compare the result to english strings. Do not test UnixCommandExecutor on Windows. PharTest: explain why PHAR writing test are skipped. InstallCommandTest: mock checkRequirements to allow the tests to run. Run php_parallel_lint before all other tests. Close #846
This commit is contained in:
parent
9590336c49
commit
452a5ba97c
|
@ -156,7 +156,7 @@ class Lang
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once($langFile);
|
require($langFile);
|
||||||
|
|
||||||
if (is_null($strings) || !is_array($strings) || !count($strings)) {
|
if (is_null($strings) || !is_array($strings) || !count($strings)) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -185,7 +185,7 @@ class Factory
|
||||||
return $class->getName();
|
return $class->getName();
|
||||||
} elseif ($param->isArray()) {
|
} elseif ($param->isArray()) {
|
||||||
return self::TYPE_ARRAY;
|
return self::TYPE_ARRAY;
|
||||||
} elseif ($param->isCallable()) {
|
} elseif (is_callable($param)) {
|
||||||
return self::TYPE_CALLABLE;
|
return self::TYPE_CALLABLE;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPCI - Continuous Integration for PHP
|
* PHPCI - Continuous Integration for PHP
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2014, Block 8 Limited.
|
* @copyright Copyright 2014, Block 8 Limited.
|
||||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
* @link http://www.phptesting.org/
|
* @link https://www.phptesting.org/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PHPCI\Plugin\Tests\Command;
|
namespace Tests\PHPCI\Plugin\Command;
|
||||||
|
|
||||||
use Symfony\Component\Console\Application;
|
use Symfony\Component\Console\Application;
|
||||||
use Symfony\Component\Console\Tester\CommandTester;
|
use Symfony\Component\Console\Tester\CommandTester;
|
||||||
|
@ -34,17 +35,17 @@ class CreateAdminCommandTest extends \PHPUnit_Framework_TestCase
|
||||||
parent::setup();
|
parent::setup();
|
||||||
|
|
||||||
$this->command = $this->getMockBuilder('PHPCI\\Command\\CreateAdminCommand')
|
$this->command = $this->getMockBuilder('PHPCI\\Command\\CreateAdminCommand')
|
||||||
->setConstructorArgs([$this->getMock('PHPCI\\Store\\UserStore')])
|
->setConstructorArgs(array($this->getMock('PHPCI\\Store\\UserStore')))
|
||||||
->setMethods(['reloadConfig'])
|
->setMethods(array('reloadConfig'))
|
||||||
->getMock()
|
->getMock()
|
||||||
;
|
;
|
||||||
|
|
||||||
$this->dialog = $this->getMockBuilder('Symfony\\Component\\Console\\Helper\\DialogHelper')
|
$this->dialog = $this->getMockBuilder('Symfony\\Component\\Console\\Helper\\DialogHelper')
|
||||||
->setMethods([
|
->setMethods(array(
|
||||||
'ask',
|
'ask',
|
||||||
'askAndValidate',
|
'askAndValidate',
|
||||||
'askHiddenResponse',
|
'askHiddenResponse',
|
||||||
])
|
))
|
||||||
->getMock()
|
->getMock()
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -71,7 +72,7 @@ class CreateAdminCommandTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->dialog->expects($this->at(2))->method('askHiddenResponse')->will($this->returnValue('foobar123'));
|
$this->dialog->expects($this->at(2))->method('askHiddenResponse')->will($this->returnValue('foobar123'));
|
||||||
|
|
||||||
$commandTester = $this->getCommandTester();
|
$commandTester = $this->getCommandTester();
|
||||||
$commandTester->execute([]);
|
$commandTester->execute(array());
|
||||||
|
|
||||||
$this->assertEquals('User account created!' . PHP_EOL, $commandTester->getDisplay());
|
$this->assertEquals('User account created!' . PHP_EOL, $commandTester->getDisplay());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,23 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPCI\Plugin\Tests\Command;
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Plugin\Command;
|
||||||
|
|
||||||
use Symfony\Component\Console\Application;
|
use Symfony\Component\Console\Application;
|
||||||
use Prophecy\PhpUnit\ProphecyTestCase;
|
|
||||||
use Symfony\Component\Console\Tester\CommandTester;
|
use Symfony\Component\Console\Tester\CommandTester;
|
||||||
use Symfony\Component\Console\Helper\HelperSet;
|
use Symfony\Component\Console\Helper\HelperSet;
|
||||||
|
|
||||||
class InstallCommandTest extends ProphecyTestCase
|
class InstallCommandTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
protected $config;
|
public $config;
|
||||||
protected $admin;
|
public $admin;
|
||||||
protected $application;
|
protected $application;
|
||||||
|
|
||||||
public function setup()
|
public function setup()
|
||||||
|
@ -55,22 +62,26 @@ class InstallCommandTest extends ProphecyTestCase
|
||||||
'setupDatabase',
|
'setupDatabase',
|
||||||
'createAdminUser',
|
'createAdminUser',
|
||||||
'writeConfigFile',
|
'writeConfigFile',
|
||||||
|
'checkRequirements',
|
||||||
))
|
))
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
$self = $this;
|
||||||
|
|
||||||
$command->expects($this->once())->method('verifyNotInstalled')->willReturn(true);
|
$command->expects($this->once())->method('verifyNotInstalled')->willReturn(true);
|
||||||
$command->expects($this->once())->method('verifyDatabaseDetails')->willReturn(true);
|
$command->expects($this->once())->method('verifyDatabaseDetails')->willReturn(true);
|
||||||
$command->expects($this->once())->method('setupDatabase')->willReturn(true);
|
$command->expects($this->once())->method('setupDatabase')->willReturn(true);
|
||||||
$command->expects($this->once())->method('createAdminUser')->will(
|
$command->expects($this->once())->method('createAdminUser')->will(
|
||||||
$this->returnCallback(function ($adm) {// use (&$admin) {
|
$this->returnCallback(function ($adm) use ($self) {
|
||||||
$this->admin = $adm;
|
$self->admin = $adm;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
$command->expects($this->once())->method('writeConfigFile')->will(
|
$command->expects($this->once())->method('writeConfigFile')->will(
|
||||||
$this->returnCallback(function ($cfg) { //use (&$config) {
|
$this->returnCallback(function ($cfg) use ($self) {
|
||||||
$this->config = $cfg;
|
$self->config = $cfg;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
$command->expects($this->once())->method('checkRequirements');
|
||||||
|
|
||||||
return $command;
|
return $command;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPCI - Continuous Integration for PHP
|
* PHPCI - Continuous Integration for PHP
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2014, Block 8 Limited.
|
* @copyright Copyright 2014, Block 8 Limited.
|
||||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
* @link http://www.phptesting.org/
|
* @link https://www.phptesting.org/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PHPCI\Tests\Controller;
|
namespace Tests\PHPCI\Controller;
|
||||||
|
|
||||||
use PHPCI\Controller\WebhookController;
|
use PHPCI\Controller\WebhookController;
|
||||||
use Prophecy\PhpUnit\ProphecyTestCase;
|
|
||||||
|
|
||||||
class WebhookControllerTest extends ProphecyTestCase
|
class WebhookControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function test_wrong_action_name_return_json_with_error()
|
public function test_wrong_action_name_return_json_with_error()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,12 +1,27 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPCI\Helper\Tests;
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Helper;
|
||||||
|
|
||||||
use PHPCI\Helper\AnsiConverter;
|
use PHPCI\Helper\AnsiConverter;
|
||||||
use PHPUnit_Framework_TestCase;
|
use PHPUnit_Framework_TestCase;
|
||||||
|
|
||||||
class AnsiConverterTest extends PHPUnit_Framework_TestCase
|
class AnsiConverterTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
|
||||||
|
$this->markTestSkipped('External library do not support PHP 5.3');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function testConvert_convertToHtml()
|
public function testConvert_convertToHtml()
|
||||||
{
|
{
|
||||||
$input = "\e[31mThis is red !\e[0m";
|
$input = "\e[31mThis is red !\e[0m";
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPCI\Plugin\Tests\Helper;
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Plugin\Helper;
|
||||||
|
|
||||||
use PHPCI\Helper\BuildInterpolator;
|
use PHPCI\Helper\BuildInterpolator;
|
||||||
use Prophecy\PhpUnit\ProphecyTestCase;
|
|
||||||
|
|
||||||
class BuildInterpolatorTest extends ProphecyTestCase
|
class BuildInterpolatorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var BuildInterpolator
|
* @var BuildInterpolator
|
||||||
|
@ -46,4 +53,4 @@ class BuildInterpolatorTest extends ProphecyTestCase
|
||||||
$this->assertEquals($expectedOutput, $actualOutput);
|
$this->assertEquals($expectedOutput, $actualOutput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPCI\Plugin\Tests\Helper;
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Plugin\Helper;
|
||||||
|
|
||||||
use PHPCI\Helper\UnixCommandExecutor;
|
use PHPCI\Helper\UnixCommandExecutor;
|
||||||
use \Prophecy\PhpUnit\ProphecyTestCase;
|
|
||||||
|
|
||||||
class CommandExecutorTest extends ProphecyTestCase
|
class CommandExecutorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var UnixCommandExecutor
|
* @var UnixCommandExecutor
|
||||||
|
@ -14,6 +21,10 @@ class CommandExecutorTest extends ProphecyTestCase
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
|
if (IS_WIN) {
|
||||||
|
$this->markTestSkipped("Cannot test UnixCommandExecutor on ".PHP_OS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$mockBuildLogger = $this->prophesize('PHPCI\Logging\BuildLogger');
|
$mockBuildLogger = $this->prophesize('PHPCI\Logging\BuildLogger');
|
||||||
$this->testedExecutor = new UnixCommandExecutor($mockBuildLogger->reveal(), __DIR__ . "/");
|
$this->testedExecutor = new UnixCommandExecutor($mockBuildLogger->reveal(), __DIR__ . "/");
|
||||||
|
@ -52,4 +63,4 @@ class CommandExecutorTest extends ProphecyTestCase
|
||||||
$returnValue = $this->testedExecutor->findBinary($thisFileName);
|
$returnValue = $this->testedExecutor->findBinary($thisFileName);
|
||||||
$this->assertEquals(__DIR__ . "/" . $thisFileName, $returnValue);
|
$this->assertEquals(__DIR__ . "/" . $thisFileName, $returnValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPCI\Tests\Helper;
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Helper;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use PHPCI\Helper\Lang;
|
use PHPCI\Helper\Lang;
|
||||||
use Prophecy\PhpUnit\ProphecyTestCase;
|
|
||||||
|
|
||||||
class LangTest extends ProphecyTestCase
|
class LangTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testLang_UsePassedParameters()
|
public function testLang_UsePassedParameters()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPCI - Continuous Integration for PHP
|
* PHPCI - Continuous Integration for PHP
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2014, Block 8 Limited.
|
* @copyright Copyright 2014, Block 8 Limited.
|
||||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
* @link http://www.phptesting.org/
|
* @link https://www.phptesting.org/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PHPCI\Service\Tests;
|
namespace tests\PHPCI\Service;
|
||||||
|
|
||||||
use PHPCI\Helper\MailerFactory;
|
use PHPCI\Helper\MailerFactory;
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPCI\Plugin\Tests\Helper;
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Plugin\Helper;
|
||||||
|
|
||||||
use PHPCI\Logging\BuildLogger;
|
use PHPCI\Logging\BuildLogger;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\PhpUnit\ProphecyTestCase;
|
|
||||||
use Psr\Log\LogLevel;
|
use Psr\Log\LogLevel;
|
||||||
|
|
||||||
class BuildLoggerTest extends ProphecyTestCase
|
class BuildLoggerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var BuildLogger
|
* @var BuildLogger
|
||||||
|
@ -104,4 +111,4 @@ class BuildLoggerTest extends ProphecyTestCase
|
||||||
$this->testedBuildLogger->logFailure($message, $exception);
|
$this->testedBuildLogger->logFailure($message, $exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPCI\Plugin\Tests\Helper;
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Plugin\Helper;
|
||||||
|
|
||||||
use \PHPCI\Logging\LoggerConfig;
|
use \PHPCI\Logging\LoggerConfig;
|
||||||
|
|
||||||
|
@ -74,4 +82,4 @@ class LoggerConfigTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertNotSame($alternativeHandler, $actualHandler);
|
$this->assertNotSame($alternativeHandler, $actualHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPCI - Continuous Integration for PHP
|
* PHPCI - Continuous Integration for PHP
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2014, Block 8 Limited.
|
* @copyright Copyright 2014, Block 8 Limited.
|
||||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
* @link http://www.phptesting.org/
|
* @link https://www.phptesting.org/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PHPCI\Model\Tests;
|
|
||||||
|
namespace Tests\PHPCI\Model;
|
||||||
|
|
||||||
use PHPCI\Model\Build;
|
use PHPCI\Model\Build;
|
||||||
use PHPCI\Model;
|
use PHPCI\Model;
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPCI - Continuous Integration for PHP
|
* PHPCI - Continuous Integration for PHP
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2014, Block 8 Limited.
|
* @copyright Copyright 2014, Block 8 Limited.
|
||||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
* @link http://www.phptesting.org/
|
* @link https://www.phptesting.org/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PHPCI\Model\Tests;
|
|
||||||
|
namespace Tests\PHPCI\Model;
|
||||||
|
|
||||||
use PHPCI\Model\Project;
|
use PHPCI\Model\Project;
|
||||||
use PHPCI\Model;
|
use PHPCI\Model;
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPCI - Continuous Integration for PHP
|
* PHPCI - Continuous Integration for PHP
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2013, Block 8 Limited.
|
* @copyright Copyright 2013, Block 8 Limited.
|
||||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
* @link http://www.phptesting.org/
|
* @link https://www.phptesting.org/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PHPCI\Plugin\Tests;
|
namespace Tests\PHPCI\Plugin;
|
||||||
|
|
||||||
use PHPCI\Plugin\Email as EmailPlugin;
|
use PHPCI\Plugin\Email as EmailPlugin;
|
||||||
use PHPCI\Model\Build;
|
use PHPCI\Model\Build;
|
||||||
|
@ -42,22 +43,23 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
||||||
/**
|
/**
|
||||||
* @var int buildStatus
|
* @var int buildStatus
|
||||||
*/
|
*/
|
||||||
protected $buildStatus;
|
public $buildStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array $message;
|
* @var array $message;
|
||||||
*/
|
*/
|
||||||
protected $message;
|
public $message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool $mailDelivered
|
* @var bool $mailDelivered
|
||||||
*/
|
*/
|
||||||
protected $mailDelivered;
|
public $mailDelivered;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->message = array();
|
$this->message = array();
|
||||||
$this->mailDelivered = true;
|
$this->mailDelivered = true;
|
||||||
|
$self = $this;
|
||||||
|
|
||||||
$this->mockProject = $this->getMock(
|
$this->mockProject = $this->getMock(
|
||||||
'\PHPCI\Model\Project',
|
'\PHPCI\Model\Project',
|
||||||
|
@ -85,8 +87,8 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
$this->mockBuild->expects($this->any())
|
$this->mockBuild->expects($this->any())
|
||||||
->method('getStatus')
|
->method('getStatus')
|
||||||
->will($this->returnCallback(function () {
|
->will($this->returnCallback(function () use ($self) {
|
||||||
return $this->buildStatus;
|
return $self->buildStatus;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$this->mockBuild->expects($this->any())
|
$this->mockBuild->expects($this->any())
|
||||||
|
@ -138,6 +140,8 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
||||||
// Reset current message.
|
// Reset current message.
|
||||||
$this->message = array();
|
$this->message = array();
|
||||||
|
|
||||||
|
$self = $this;
|
||||||
|
|
||||||
$this->testedEmailPlugin = $this->getMock(
|
$this->testedEmailPlugin = $this->getMock(
|
||||||
'\PHPCI\Plugin\Email',
|
'\PHPCI\Plugin\Email',
|
||||||
array('sendEmail'),
|
array('sendEmail'),
|
||||||
|
@ -150,13 +154,13 @@ class EmailTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
$this->testedEmailPlugin->expects($this->any())
|
$this->testedEmailPlugin->expects($this->any())
|
||||||
->method('sendEmail')
|
->method('sendEmail')
|
||||||
->will($this->returnCallback(function ($to, $cc, $subject, $body) {
|
->will($this->returnCallback(function ($to, $cc, $subject, $body) use ($self) {
|
||||||
$this->message['to'][] = $to;
|
$self->message['to'][] = $to;
|
||||||
$this->message['cc'] = $cc;
|
$self->message['cc'] = $cc;
|
||||||
$this->message['subject'] = $subject;
|
$self->message['subject'] = $subject;
|
||||||
$this->message['body'] = $body;
|
$self->message['body'] = $body;
|
||||||
|
|
||||||
return $this->mailDelivered;
|
return $self->mailDelivered;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
namespace PHPCI\Plugin\Tests;
|
|
||||||
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Plugin;
|
||||||
|
|
||||||
use PHPCI\Plugin\Phar as PharPlugin;
|
use PHPCI\Plugin\Phar as PharPlugin;
|
||||||
use Phar as PHPPhar;
|
use Phar as PHPPhar;
|
||||||
|
@ -78,8 +87,7 @@ class PharTest extends \PHPUnit_Framework_TestCase
|
||||||
protected function checkReadonly()
|
protected function checkReadonly()
|
||||||
{
|
{
|
||||||
if (ini_get('phar.readonly')) {
|
if (ini_get('phar.readonly')) {
|
||||||
$this->markTestSkipped();
|
$this->markTestSkipped('phar writing disabled in php.ini.');
|
||||||
throw new RuntimeException('Readonly Phar');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPCI\Plugin\Tests\Util;
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Plugin\Util;
|
||||||
|
|
||||||
use PHPCI\Plugin\Util\ComposerPluginInformation;
|
use PHPCI\Plugin\Util\ComposerPluginInformation;
|
||||||
|
|
||||||
|
@ -48,4 +56,4 @@ class ComposerPluginInformationTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertContainsOnly("string", $classes);
|
$this->assertContainsOnly("string", $classes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
return function (PHPCI\Plugin\Util\Factory $factory) {
|
return function (PHPCI\Plugin\Util\Factory $factory) {
|
||||||
$factory->registerResource(
|
$factory->registerResource(
|
||||||
// This function will be called when the resource is needed.
|
// This function will be called when the resource is needed.
|
||||||
|
@ -10,4 +19,4 @@ return function (PHPCI\Plugin\Util\Factory $factory) {
|
||||||
"requiredArgument",
|
"requiredArgument",
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,78 +0,0 @@
|
||||||
<?php
|
|
||||||
namespace PHPCI\Plugin\Tests\Util;
|
|
||||||
|
|
||||||
use PHPCI\Builder;
|
|
||||||
use PHPCI\Model\Build;
|
|
||||||
use PHPCI\Plugin;
|
|
||||||
|
|
||||||
class ExamplePluginWithNoConstructorArgs implements Plugin
|
|
||||||
{
|
|
||||||
public function execute()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ExamplePluginWithSingleOptionalArg implements Plugin
|
|
||||||
{
|
|
||||||
function __construct($optional = null)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function execute()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ExamplePluginWithSingleRequiredArg implements Plugin
|
|
||||||
{
|
|
||||||
|
|
||||||
public $RequiredArgument;
|
|
||||||
|
|
||||||
function __construct($requiredArgument)
|
|
||||||
{
|
|
||||||
$this->RequiredArgument = $requiredArgument;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function execute()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ExamplePluginWithSingleTypedRequiredArg implements Plugin
|
|
||||||
{
|
|
||||||
|
|
||||||
public $RequiredArgument;
|
|
||||||
|
|
||||||
function __construct(\stdClass $requiredArgument)
|
|
||||||
{
|
|
||||||
$this->RequiredArgument = $requiredArgument;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function execute()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ExamplePluginFull implements Plugin {
|
|
||||||
|
|
||||||
public $Options;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
Builder $phpci,
|
|
||||||
Build $build,
|
|
||||||
array $options = array()
|
|
||||||
)
|
|
||||||
{
|
|
||||||
$this->Options = $options;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function execute()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,14 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPCI\Plugin\Tests\Util;
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
require_once __DIR__ . "/ExamplePlugins.php";
|
namespace Tests\PHPCI\Plugin\Util;
|
||||||
|
|
||||||
use PHPCI\Plugin\Util\Executor;
|
use PHPCI\Plugin\Util\Executor;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\PhpUnit\ProphecyTestCase;
|
|
||||||
|
|
||||||
class ExecutorTest extends ProphecyTestCase
|
class ExecutorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var Executor
|
* @var Executor
|
||||||
|
@ -43,14 +48,13 @@ class ExecutorTest extends ProphecyTestCase
|
||||||
public function testExecutePlugin_KeepsCalledNameSpace()
|
public function testExecutePlugin_KeepsCalledNameSpace()
|
||||||
{
|
{
|
||||||
$options = array();
|
$options = array();
|
||||||
$pluginName = 'ExamplePluginFull';
|
$pluginClass = $this->getFakePluginClassName('ExamplePluginFull');
|
||||||
$pluginNamespace = '\\PHPCI\\Plugin\\Tests\\Util\\';
|
|
||||||
|
|
||||||
$this->mockFactory->buildPlugin($pluginNamespace . $pluginName, $options)
|
$this->mockFactory->buildPlugin($pluginClass, $options)
|
||||||
->shouldBeCalledTimes(1)
|
->shouldBeCalledTimes(1)
|
||||||
->willReturn($this->prophesize('PHPCI\Plugin')->reveal());
|
->willReturn($this->prophesize('PHPCI\Plugin')->reveal());
|
||||||
|
|
||||||
$this->testedExecutor->executePlugin($pluginNamespace . $pluginName, $options);
|
$this->testedExecutor->executePlugin($pluginClass, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testExecutePlugin_CallsExecuteOnFactoryBuildPlugin()
|
public function testExecutePlugin_CallsExecuteOnFactoryBuildPlugin()
|
||||||
|
@ -142,5 +146,11 @@ class ExecutorTest extends ProphecyTestCase
|
||||||
$this->testedExecutor->executePlugins($config, 'stageOne');
|
$this->testedExecutor->executePlugins($config, 'stageOne');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getFakePluginClassName($pluginName)
|
||||||
|
{
|
||||||
|
$pluginNamespace = '\\Tests\\PHPCI\\Plugin\\Util\\Fake\\';
|
||||||
|
|
||||||
|
return $pluginNamespace . $pluginName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPCI\Plugin\Tests\Util;
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
require_once __DIR__ . "/ExamplePlugins.php";
|
namespace Tests\PHPCI\Plugin\Util;
|
||||||
|
|
||||||
use PHPCI\Plugin\Util\Factory;
|
use PHPCI\Plugin\Util\Factory;
|
||||||
|
|
||||||
|
@ -49,10 +55,9 @@ class FactoryTest extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
public function testBuildPluginWorksWithConstructorlessPlugins()
|
public function testBuildPluginWorksWithConstructorlessPlugins()
|
||||||
{
|
{
|
||||||
$namespace = '\\PHPCI\\Plugin\\Tests\\Util\\';
|
$pluginClass = $this->getFakePluginClassName('ExamplePluginWithNoConstructorArgs');
|
||||||
$expectedPluginClass = $namespace .'ExamplePluginWithNoConstructorArgs';
|
$plugin = $this->testedFactory->buildPlugin($pluginClass);
|
||||||
$plugin = $this->testedFactory->buildPlugin($expectedPluginClass);
|
$this->assertInstanceOf($pluginClass, $plugin);
|
||||||
$this->assertInstanceOf($expectedPluginClass, $plugin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBuildPluginFailsForNonPluginClasses()
|
public function testBuildPluginFailsForNonPluginClasses()
|
||||||
|
@ -63,10 +68,9 @@ class FactoryTest extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
public function testBuildPluginWorksWithSingleOptionalArgConstructor()
|
public function testBuildPluginWorksWithSingleOptionalArgConstructor()
|
||||||
{
|
{
|
||||||
$namespace = '\\PHPCI\\Plugin\\Tests\\Util\\';
|
$pluginClass = $this->getFakePluginClassName('ExamplePluginWithSingleOptionalArg');
|
||||||
$expectedPluginClass = $namespace . 'ExamplePluginWithSingleOptionalArg';
|
$plugin = $this->testedFactory->buildPlugin($pluginClass);
|
||||||
$plugin = $this->testedFactory->buildPlugin($expectedPluginClass);
|
$this->assertInstanceOf($pluginClass, $plugin);
|
||||||
$this->assertInstanceOf($expectedPluginClass, $plugin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBuildPluginThrowsExceptionIfMissingResourcesForRequiredArg()
|
public function testBuildPluginThrowsExceptionIfMissingResourcesForRequiredArg()
|
||||||
|
@ -76,15 +80,13 @@ class FactoryTest extends \PHPUnit_Framework_TestCase {
|
||||||
'Unsatisfied dependency: requiredArgument'
|
'Unsatisfied dependency: requiredArgument'
|
||||||
);
|
);
|
||||||
|
|
||||||
$namespace = '\\PHPCI\\Plugin\\Tests\\Util\\';
|
$pluginClass = $this->getFakePluginClassName('ExamplePluginWithSingleRequiredArg');
|
||||||
$expectedPluginClass = $namespace . 'ExamplePluginWithSingleRequiredArg';
|
$plugin = $this->testedFactory->buildPlugin($pluginClass);
|
||||||
$plugin = $this->testedFactory->buildPlugin($expectedPluginClass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBuildPluginLoadsArgumentsBasedOnName()
|
public function testBuildPluginLoadsArgumentsBasedOnName()
|
||||||
{
|
{
|
||||||
$namespace = '\\PHPCI\\Plugin\\Tests\\Util\\';
|
$pluginClass = $this->getFakePluginClassName('ExamplePluginWithSingleRequiredArg');
|
||||||
$expectedPluginClass = $namespace . 'ExamplePluginWithSingleRequiredArg';
|
|
||||||
|
|
||||||
$this->testedFactory->registerResource(
|
$this->testedFactory->registerResource(
|
||||||
$this->resourceLoader,
|
$this->resourceLoader,
|
||||||
|
@ -92,15 +94,14 @@ class FactoryTest extends \PHPUnit_Framework_TestCase {
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var ExamplePluginWithSingleRequiredArg $plugin */
|
/** @var ExamplePluginWithSingleRequiredArg $plugin */
|
||||||
$plugin = $this->testedFactory->buildPlugin($expectedPluginClass);
|
$plugin = $this->testedFactory->buildPlugin($pluginClass);
|
||||||
|
|
||||||
$this->assertEquals($this->expectedResource, $plugin->RequiredArgument);
|
$this->assertEquals($this->expectedResource, $plugin->RequiredArgument);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBuildPluginLoadsArgumentsBasedOnType()
|
public function testBuildPluginLoadsArgumentsBasedOnType()
|
||||||
{
|
{
|
||||||
$namespace = '\\PHPCI\\Plugin\\Tests\\Util\\';
|
$pluginClass = $this->getFakePluginClassName('ExamplePluginWithSingleTypedRequiredArg');
|
||||||
$expectedPluginClass = $namespace . 'ExamplePluginWithSingleTypedRequiredArg';
|
|
||||||
|
|
||||||
$this->testedFactory->registerResource(
|
$this->testedFactory->registerResource(
|
||||||
$this->resourceLoader,
|
$this->resourceLoader,
|
||||||
|
@ -109,28 +110,26 @@ class FactoryTest extends \PHPUnit_Framework_TestCase {
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var ExamplePluginWithSingleTypedRequiredArg $plugin */
|
/** @var ExamplePluginWithSingleTypedRequiredArg $plugin */
|
||||||
$plugin = $this->testedFactory->buildPlugin($expectedPluginClass);
|
$plugin = $this->testedFactory->buildPlugin($pluginClass);
|
||||||
|
|
||||||
$this->assertEquals($this->expectedResource, $plugin->RequiredArgument);
|
$this->assertEquals($this->expectedResource, $plugin->RequiredArgument);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBuildPluginLoadsFullExample()
|
public function testBuildPluginLoadsFullExample()
|
||||||
{
|
{
|
||||||
$namespace = '\\PHPCI\\Plugin\\Tests\\Util\\';
|
$pluginClass = $this->getFakePluginClassName('ExamplePluginFull');
|
||||||
$expectedPluginClass = $namespace . 'ExamplePluginFull';
|
|
||||||
|
|
||||||
$this->registerBuildAndBuilder();
|
$this->registerBuildAndBuilder();
|
||||||
|
|
||||||
/** @var ExamplePluginFull $plugin */
|
/** @var ExamplePluginFull $plugin */
|
||||||
$plugin = $this->testedFactory->buildPlugin($expectedPluginClass);
|
$plugin = $this->testedFactory->buildPlugin($pluginClass);
|
||||||
|
|
||||||
$this->assertInstanceOf($expectedPluginClass, $plugin);
|
$this->assertInstanceOf($pluginClass, $plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBuildPluginLoadsFullExampleWithOptions()
|
public function testBuildPluginLoadsFullExampleWithOptions()
|
||||||
{
|
{
|
||||||
$namespace = '\\PHPCI\\Plugin\\Tests\\Util\\';
|
$pluginClass = $this->getFakePluginClassName('ExamplePluginFull');
|
||||||
$expectedPluginClass = $namespace . 'ExamplePluginFull';
|
|
||||||
|
|
||||||
$expectedArgs = array(
|
$expectedArgs = array(
|
||||||
'thing' => "stuff"
|
'thing' => "stuff"
|
||||||
|
@ -140,7 +139,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
/** @var ExamplePluginFull $plugin */
|
/** @var ExamplePluginFull $plugin */
|
||||||
$plugin = $this->testedFactory->buildPlugin(
|
$plugin = $this->testedFactory->buildPlugin(
|
||||||
$expectedPluginClass,
|
$pluginClass,
|
||||||
$expectedArgs
|
$expectedArgs
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -163,10 +162,8 @@ class FactoryTest extends \PHPUnit_Framework_TestCase {
|
||||||
realpath(__DIR__ . "/ExamplePluginConfig.php")
|
realpath(__DIR__ . "/ExamplePluginConfig.php")
|
||||||
);
|
);
|
||||||
|
|
||||||
$namespace = '\\PHPCI\\Plugin\\Tests\\Util\\';
|
$pluginClass = $this->getFakePluginClassName('ExamplePluginWithSingleRequiredArg');
|
||||||
$pluginName = $namespace . 'ExamplePluginWithSingleRequiredArg';
|
$plugin = $this->testedFactory->buildPlugin($pluginClass);
|
||||||
|
|
||||||
$plugin = $this->testedFactory->buildPlugin($pluginName);
|
|
||||||
|
|
||||||
// The Example config file defines an array as the resource.
|
// The Example config file defines an array as the resource.
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
|
@ -181,9 +178,11 @@ class FactoryTest extends \PHPUnit_Framework_TestCase {
|
||||||
*/
|
*/
|
||||||
private function registerBuildAndBuilder()
|
private function registerBuildAndBuilder()
|
||||||
{
|
{
|
||||||
|
$self = $this;
|
||||||
|
|
||||||
$this->testedFactory->registerResource(
|
$this->testedFactory->registerResource(
|
||||||
function () {
|
function () use ($self) {
|
||||||
return $this->getMock(
|
return $self->getMock(
|
||||||
'PHPCI\Builder',
|
'PHPCI\Builder',
|
||||||
array(),
|
array(),
|
||||||
array(),
|
array(),
|
||||||
|
@ -196,8 +195,8 @@ class FactoryTest extends \PHPUnit_Framework_TestCase {
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->testedFactory->registerResource(
|
$this->testedFactory->registerResource(
|
||||||
function () {
|
function () use ($self) {
|
||||||
return $this->getMock(
|
return $self->getMock(
|
||||||
'PHPCI\Model\Build',
|
'PHPCI\Model\Build',
|
||||||
array(),
|
array(),
|
||||||
array(),
|
array(),
|
||||||
|
@ -206,8 +205,15 @@ class FactoryTest extends \PHPUnit_Framework_TestCase {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
'PHPCI\\Model\Build'
|
'PHPCI\\Model\\Build'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getFakePluginClassName($pluginName)
|
||||||
|
{
|
||||||
|
$pluginNamespace = '\\Tests\\PHPCI\\Plugin\\Util\\Fake\\';
|
||||||
|
|
||||||
|
return $pluginNamespace . $pluginName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
36
Tests/PHPCI/Plugin/Util/Fake/ExamplePluginFull.php
Normal file
36
Tests/PHPCI/Plugin/Util/Fake/ExamplePluginFull.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Plugin\Util\Fake;
|
||||||
|
|
||||||
|
use PHPCI\Builder;
|
||||||
|
use PHPCI\Model\Build;
|
||||||
|
use PHPCI\Plugin;
|
||||||
|
|
||||||
|
class ExamplePluginFull implements Plugin {
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $Options;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
Builder $phpci,
|
||||||
|
Build $build,
|
||||||
|
array $options = array()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$this->Options = $options;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Plugin\Util\Fake;
|
||||||
|
|
||||||
|
use PHPCI\Plugin;
|
||||||
|
|
||||||
|
class ExamplePluginWithNoConstructorArgs implements Plugin
|
||||||
|
{
|
||||||
|
public function execute()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Plugin\Util\Fake;
|
||||||
|
|
||||||
|
use PHPCI\Plugin;
|
||||||
|
|
||||||
|
class ExamplePluginWithSingleOptionalArg implements Plugin
|
||||||
|
{
|
||||||
|
function __construct($optional = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Plugin\Util\Fake;
|
||||||
|
|
||||||
|
use PHPCI\Plugin;
|
||||||
|
|
||||||
|
class ExamplePluginWithSingleRequiredArg implements Plugin
|
||||||
|
{
|
||||||
|
|
||||||
|
public $RequiredArgument;
|
||||||
|
|
||||||
|
function __construct($requiredArgument)
|
||||||
|
{
|
||||||
|
$this->RequiredArgument = $requiredArgument;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Plugin\Util\Fake;
|
||||||
|
|
||||||
|
use PHPCI\Plugin;
|
||||||
|
|
||||||
|
class ExamplePluginWithSingleTypedRequiredArg implements Plugin
|
||||||
|
{
|
||||||
|
|
||||||
|
public $RequiredArgument;
|
||||||
|
|
||||||
|
function __construct(\stdClass $requiredArgument)
|
||||||
|
{
|
||||||
|
$this->RequiredArgument = $requiredArgument;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PHPCI\Plugin\Tests\Util;
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Plugin\Util;
|
||||||
|
|
||||||
use PHPCI\Plugin\Util\FilesPluginInformation;
|
use PHPCI\Plugin\Util\FilesPluginInformation;
|
||||||
|
|
||||||
|
@ -23,4 +31,4 @@ class FilesPluginInformationTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertContainsOnly('string', $pluginInfos);
|
$this->assertContainsOnly('string', $pluginInfos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
namespace PHPCI\Plugin\Tests\Util;
|
|
||||||
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\PHPCI\Plugin\Util;
|
||||||
|
|
||||||
use PHPCI\Plugin\Util\TapParser;
|
use PHPCI\Plugin\Util\TapParser;
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPCI - Continuous Integration for PHP
|
* PHPCI - Continuous Integration for PHP
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2014, Block 8 Limited.
|
* @copyright Copyright 2014, Block 8 Limited.
|
||||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
* @link http://www.phptesting.org/
|
* @link https://www.phptesting.org/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PHPCI\Service\Tests;
|
namespace Tests\PHPCI\Service;
|
||||||
|
|
||||||
use PHPCI\Model\Build;
|
use PHPCI\Model\Build;
|
||||||
use PHPCI\Model\Project;
|
use PHPCI\Model\Project;
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPCI - Continuous Integration for PHP
|
* PHPCI - Continuous Integration for PHP
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2014, Block 8 Limited.
|
* @copyright Copyright 2014, Block 8 Limited.
|
||||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
* @link http://www.phptesting.org/
|
* @link https://www.phptesting.org/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PHPCI\Service\Tests;
|
|
||||||
|
namespace Tests\PHPCI\Service;
|
||||||
|
|
||||||
use PHPCI\Model\Project;
|
use PHPCI\Model\Project;
|
||||||
use PHPCI\Service\ProjectService;
|
use PHPCI\Service\ProjectService;
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPCI - Continuous Integration for PHP
|
* PHPCI - Continuous Integration for PHP
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2014, Block 8 Limited.
|
* @copyright Copyright 2014, Block 8 Limited.
|
||||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
* @link http://www.phptesting.org/
|
* @link https://www.phptesting.org/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PHPCI\Service\Tests;
|
namespace Tests\PHPCI\Service;
|
||||||
|
|
||||||
use PHPCI\Model\User;
|
use PHPCI\Model\User;
|
||||||
use PHPCI\Service\UserService;
|
use PHPCI\Service\UserService;
|
||||||
|
|
|
@ -40,3 +40,4 @@ if (file_exists($configFile)) {
|
||||||
require_once(dirname(__DIR__) . '/vars.php');
|
require_once(dirname(__DIR__) . '/vars.php');
|
||||||
|
|
||||||
\PHPCI\Helper\Lang::init($config);
|
\PHPCI\Helper\Lang::init($config);
|
||||||
|
\PHPCI\Helper\Lang::setLanguage("en");
|
||||||
|
|
|
@ -41,12 +41,16 @@
|
||||||
"monolog/monolog": "~1.6",
|
"monolog/monolog": "~1.6",
|
||||||
"pimple/pimple": "~1.1",
|
"pimple/pimple": "~1.1",
|
||||||
"robmorgan/phinx": "~0.4",
|
"robmorgan/phinx": "~0.4",
|
||||||
"sensiolabs/ansi-to-html": "~1.1"
|
"sensiolabs/ansi-to-html": "~1.1",
|
||||||
|
"jakub-onderka/php-parallel-lint": "0.8.*"
|
||||||
|
},
|
||||||
|
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": { "Tests\\PHPCI\\": "Tests/PHPCI" }
|
||||||
},
|
},
|
||||||
|
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "~4.0",
|
"phpunit/phpunit": "~4.5",
|
||||||
"phpspec/prophecy-phpunit": "~1.0",
|
|
||||||
"phpmd/phpmd": "~2.0",
|
"phpmd/phpmd": "~2.0",
|
||||||
"squizlabs/php_codesniffer": "~2.0",
|
"squizlabs/php_codesniffer": "~2.0",
|
||||||
"block8/php-docblock-checker": "~1.0",
|
"block8/php-docblock-checker": "~1.0",
|
||||||
|
|
121
composer.lock
generated
121
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "5fc23800ea77b50b496d34f7aa5cf6b3",
|
"hash": "0c9efd3a0b9e924c7465e03fc97ffed7",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "block8/b8framework",
|
"name": "block8/b8framework",
|
||||||
|
@ -95,6 +95,53 @@
|
||||||
],
|
],
|
||||||
"time": "2014-11-20 16:49:30"
|
"time": "2014-11-20 16:49:30"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "jakub-onderka/php-parallel-lint",
|
||||||
|
"version": "v0.8",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/JakubOnderka/PHP-Parallel-Lint.git",
|
||||||
|
"reference": "2b242dcdbdd7369d2a746518ac31bb30c514b728"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/JakubOnderka/PHP-Parallel-Lint/zipball/2b242dcdbdd7369d2a746518ac31bb30c514b728",
|
||||||
|
"reference": "2b242dcdbdd7369d2a746518ac31bb30c514b728",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"jakub-onderka/php-console-highlighter": "~0.3",
|
||||||
|
"nette/tester": "~1.3"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"jakub-onderka/php-console-highlighter": "Highlight syntax in code snippet"
|
||||||
|
},
|
||||||
|
"bin": [
|
||||||
|
"parallel-lint"
|
||||||
|
],
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"./"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"BSD"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jakub Onderka",
|
||||||
|
"email": "jakub.onderka@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "This tool check syntax of PHP files about 20x faster than serial check.",
|
||||||
|
"homepage": "https://github.com/JakubOnderka/PHP-Parallel-Lint",
|
||||||
|
"time": "2014-10-05 10:19:39"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "monolog/monolog",
|
"name": "monolog/monolog",
|
||||||
"version": "1.12.0",
|
"version": "1.12.0",
|
||||||
|
@ -172,12 +219,12 @@
|
||||||
"version": "v1.1.1",
|
"version": "v1.1.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/fabpot/Pimple.git",
|
"url": "https://github.com/silexphp/Pimple.git",
|
||||||
"reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d"
|
"reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/fabpot/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d",
|
"url": "https://api.github.com/repos/silexphp/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d",
|
||||||
"reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d",
|
"reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
|
@ -202,9 +249,7 @@
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Fabien Potencier",
|
"name": "Fabien Potencier",
|
||||||
"email": "fabien@symfony.com",
|
"email": "fabien@symfony.com"
|
||||||
"homepage": "http://fabien.potencier.org",
|
|
||||||
"role": "Lead Developer"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Pimple is a simple Dependency Injection Container for PHP 5.3",
|
"description": "Pimple is a simple Dependency Injection Container for PHP 5.3",
|
||||||
|
@ -977,56 +1022,6 @@
|
||||||
],
|
],
|
||||||
"time": "2014-11-17 16:23:49"
|
"time": "2014-11-17 16:23:49"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "phpspec/prophecy-phpunit",
|
|
||||||
"version": "v1.1.0",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/phpspec/prophecy-phpunit.git",
|
|
||||||
"reference": "0d06c84b9f26aab2b9940354f0fe6037dd9799c3"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/0d06c84b9f26aab2b9940354f0fe6037dd9799c3",
|
|
||||||
"reference": "0d06c84b9f26aab2b9940354f0fe6037dd9799c3",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=5.3.3",
|
|
||||||
"phpspec/prophecy": "~1.3"
|
|
||||||
},
|
|
||||||
"suggest": {
|
|
||||||
"phpunit/phpunit": "if it is not installed globally"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-master": "1.0.x-dev"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Prophecy\\PhpUnit\\": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Christophe Coevoet",
|
|
||||||
"email": "stof@notk.org"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "PhpUnit test case integrating the Prophecy mocking library",
|
|
||||||
"homepage": "http://phpspec.net",
|
|
||||||
"keywords": [
|
|
||||||
"phpunit",
|
|
||||||
"prophecy"
|
|
||||||
],
|
|
||||||
"time": "2015-02-09 11:20:26"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-code-coverage",
|
"name": "phpunit/php-code-coverage",
|
||||||
"version": "2.0.15",
|
"version": "2.0.15",
|
||||||
|
@ -1273,16 +1268,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "4.5.0",
|
"version": "4.5.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "5b578d3865a9128b9c209b011fda6539ec06e7a5"
|
"reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5b578d3865a9128b9c209b011fda6539ec06e7a5",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d6429b0995b24a2d9dfe5587ee3a7071c1161af4",
|
||||||
"reference": "5b578d3865a9128b9c209b011fda6539ec06e7a5",
|
"reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -1292,8 +1287,8 @@
|
||||||
"ext-reflection": "*",
|
"ext-reflection": "*",
|
||||||
"ext-spl": "*",
|
"ext-spl": "*",
|
||||||
"php": ">=5.3.3",
|
"php": ">=5.3.3",
|
||||||
"phpspec/prophecy": "~1.3.1",
|
"phpspec/prophecy": "~1.3,>=1.3.1",
|
||||||
"phpunit/php-code-coverage": "~2.0",
|
"phpunit/php-code-coverage": "~2.0,>=2.0.11",
|
||||||
"phpunit/php-file-iterator": "~1.3.2",
|
"phpunit/php-file-iterator": "~1.3.2",
|
||||||
"phpunit/php-text-template": "~1.2",
|
"phpunit/php-text-template": "~1.2",
|
||||||
"phpunit/php-timer": "~1.0.2",
|
"phpunit/php-timer": "~1.0.2",
|
||||||
|
@ -1341,7 +1336,7 @@
|
||||||
"testing",
|
"testing",
|
||||||
"xunit"
|
"xunit"
|
||||||
],
|
],
|
||||||
"time": "2015-02-05 15:51:19"
|
"time": "2015-03-29 09:24:05"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit-mock-objects",
|
"name": "phpunit/phpunit-mock-objects",
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2014, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
/** Loggers attached to every command */
|
/** Loggers attached to every command */
|
||||||
"_" => function() {
|
"_" => function() {
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2014, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
require_once(dirname(__FILE__) . '/bootstrap.php');
|
require_once(dirname(__FILE__) . '/bootstrap.php');
|
||||||
|
|
||||||
$writeServers = $config->get('b8.database.servers.write');
|
$writeServers = $config->get('b8.database.servers.write');
|
||||||
|
|
Loading…
Reference in a new issue