Test fixes

This commit is contained in:
Dmitry Khomutov 2016-04-20 19:51:10 +06:00
parent 5b9c1d32f1
commit 6c4c669492
8 changed files with 32 additions and 36 deletions

View file

@ -9,35 +9,35 @@
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./Tests/bootstrap.php"
bootstrap="./tests/bootstrap.php"
>
<testsuites>
<testsuite name="PHPCI Command Test Suite">
<directory suffix="Test.php">./Tests/PHPCI/Command</directory>
<directory suffix="Test.php">./tests/PHPCI/Command</directory>
</testsuite>
<testsuite name="PHPCI Controller Test Suite">
<directory suffix="Test.php">./Tests/PHPCI/Controller</directory>
<directory suffix="Test.php">./tests/PHPCI/Controller</directory>
</testsuite>
<testsuite name="PHPCI Helper Test Suite">
<directory suffix="Test.php">./Tests/PHPCI/Helper</directory>
<directory suffix="Test.php">./tests/PHPCI/Helper</directory>
</testsuite>
<testsuite name="PHPCI Logging Test Suite">
<directory suffix="Test.php">./Tests/PHPCI/Logging</directory>
<directory suffix="Test.php">./tests/PHPCI/Logging</directory>
</testsuite>
<testsuite name="PHPCI Model Test Suite">
<directory suffix="Test.php">./Tests/PHPCI/Model</directory>
<directory suffix="Test.php">./tests/PHPCI/Model</directory>
</testsuite>
<testsuite name="PHPCI Plugin Test Suite">
<directory suffix="Test.php">./Tests/PHPCI/Plugin</directory>
<directory suffix="Test.php">./tests/PHPCI/Plugin</directory>
</testsuite>
<!--<testsuite name="PHPCI ProcessControl Test Suite">
<directory suffix="Test.php">./Tests/PHPCI/ProcessControl</directory>
<directory suffix="Test.php">./tests/PHPCI/ProcessControl</directory>
</testsuite>-->
<testsuite name="PHPCI Service Test Suite">
<directory suffix="Test.php">./Tests/PHPCI/Service</directory>
<directory suffix="Test.php">./tests/PHPCI/Service</directory>
</testsuite>
<!--<testsuite name="B8Framework Test Suite">
<directory suffix="Test.php">./B8Framework/tests</directory>
<directory suffix="Test.php">./tests/B8Framework</directory>
</testsuite>-->
</testsuites>
</phpunit>

View file

@ -63,7 +63,7 @@ abstract class BaseCommandExecutor implements CommandExecutor
$this->quiet = $quiet;
$this->verbose = $verbose;
$this->lastOutput = array();
$this->rootDir = $rootDir;
$this->rootDir = rtrim($rootDir, '/\\') . DIRECTORY_SEPARATOR;
}
/**

View file

@ -1,7 +1,7 @@
<html>
<head>
<style>
<?php include(__DIR__ . '/../../../public/assets/css/ansi-colors.css'); ?>
<?php include(__DIR__ . '/../../../../public/assets/css/ansi-colors.css'); ?>
body { font-family: arial, verdana, sans-serif; font-size: 15px; }
header { font-size: 25px; margin-bottom: 15px; }
</style>

View file

@ -15,20 +15,11 @@ use 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()
{
$input = "\e[31mThis is red !\e[0m";
$input = "\e[31mThis is red !\e[0m";
$expectedOutput = '<span class="ansi_color_bg_black ansi_color_fg_red">This is red !</span>';
$actualOutput = AnsiConverter::convert($input);
$actualOutput = AnsiConverter::convert($input);
$this->assertEquals($expectedOutput, $actualOutput);
}

View file

@ -8,7 +8,7 @@
* @link https://www.phptesting.org/
*/
namespace Tests\PHPCI\Plugin\Helper;
namespace Tests\PHPCI\Helper;
use PHPCI\Helper\UnixCommandExecutor;
@ -26,9 +26,13 @@ class CommandExecutorTest extends \PHPUnit_Framework_TestCase
return;
}
parent::setUp();
$mockBuildLogger = $this->prophesize('PHPCI\Logging\BuildLogger');
$class = IS_WIN ? 'PHPCI\Helper\WindowsCommandExecutor' : 'PHPCI\Helper\UnixCommandExecutor';
$this->testedExecutor = new $class($mockBuildLogger->reveal(), __DIR__ . "CommandExecutorTest.php/");
$class = IS_WIN
? 'PHPCI\Helper\WindowsCommandExecutor'
: 'PHPCI\Helper\UnixCommandExecutor';
$this->testedExecutor = new $class($mockBuildLogger->reveal(), __DIR__);
}
public function testGetLastOutput_ReturnsOutputOfCommand()
@ -62,7 +66,7 @@ class CommandExecutorTest extends \PHPUnit_Framework_TestCase
{
$thisFileName = "CommandExecutorTest.php";
$returnValue = $this->testedExecutor->findBinary($thisFileName);
$this->assertEquals(__DIR__ . "CommandExecutorTest.php/" . $thisFileName, $returnValue);
$this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . $thisFileName, $returnValue);
}
/**

View file

@ -12,7 +12,6 @@ namespace Tests\PHPCI\Plugin;
use PHPCI\Plugin\Phar as PharPlugin;
use Phar as PHPPhar;
use RuntimeException;
class PharTest extends \PHPUnit_Framework_TestCase
{

View file

@ -17,17 +17,19 @@ class FilesPluginInformationTest extends \PHPUnit_Framework_TestCase
public function testGetInstalledPlugins_returnsObjects()
{
$pluginDirPath = realpath(__DIR__ . "/../../../../PHPCI/Plugin/");
$test = FilesPluginInformation::newFromDir($pluginDirPath);
$pluginInfos = $test->getInstalledPlugins();
$pluginDirPath = dirname(dirname(dirname(dirname(__DIR__)))) . "/src/PHPCI/Plugin/";
$test = FilesPluginInformation::newFromDir($pluginDirPath);
$pluginInfos = $test->getInstalledPlugins();
$this->assertContainsOnlyInstancesOf('stdClass', $pluginInfos);
}
public function testGetPluginClasses_returnsStrings()
{
$pluginDirPath = realpath(__DIR__ . "/../../../../PHPCI/Plugin/");
$test = FilesPluginInformation::newFromDir($pluginDirPath);
$pluginInfos = $test->getPluginClasses();
$pluginDirPath = dirname(dirname(dirname(dirname(__DIR__)))) . "/src/PHPCI/Plugin";
$test = FilesPluginInformation::newFromDir($pluginDirPath);
$pluginInfos = $test->getPluginClasses();
$this->assertContainsOnly('string', $pluginInfos);
}
}

View file

@ -15,7 +15,7 @@ require_once(dirname(__DIR__) . '/vendor/autoload.php');
// If the PHPCI config file is not where we expect it, try looking in
// env for an alternative config path.
$configFile = dirname(__FILE__) . '/../PHPCI/config.yml';
$configFile = dirname(__DIR__) . '/app/PHPCI/config.yml';
if (!file_exists($configFile)) {
$configEnv = getenv('phpci_config_file');
@ -29,7 +29,7 @@ if (!file_exists($configFile)) {
$conf = array();
$conf['b8']['app']['namespace'] = 'PHPCI';
$conf['b8']['app']['default_controller'] = 'Home';
$conf['b8']['view']['path'] = dirname(__DIR__) . '/PHPCI/View/';
$conf['b8']['view']['path'] = dirname(__DIR__) . '/src/PHPCI/View/';
$config = new b8\Config($conf);