0
0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2024-11-23 00:12:37 +00:00
salesagility_SuiteCRM/tests/unit/phpunit/lib/SuiteCRM/Robo/Commands/CodeCoverageCommandsTest.php
Dillon-Brown 26aab7535d Move test namespaces into autoload-dev
Signed-off-by: Dillon-Brown <dillon.brown@salesagility.com>
2021-09-08 16:49:16 +01:00

65 lines
1.8 KiB
PHP

<?php
use \SuiteCRM\Robo\Plugin\Commands\CodeCoverageCommands;
use SuiteCRM\Test\SuitePHPUnitFrameworkTestCase;
class CodeCoverageCommandsTest extends SuitePHPUnitFrameworkTestCase
{
/**
* @var \UnitTester
*/
protected $tester;
/** @var \SuiteCRM\Robo\Plugin\Commands\CodeCoverageCommands **/
protected static $testClass;
protected function setUp(): void
{
parent::setUp();
if (self::$testClass === null) {
self::$testClass = new CodeCoverageCommands();
}
}
public function testIsEnvironmentTravisCI(): void
{
$method = (new ReflectionClass(CodeCoverageCommands::class))->getMethod('isEnvironmentTravisCI');
$method->setAccessible(true);
$actual = $method->invoke(
self::$testClass
);
$returnType = is_string($actual) || is_array($actual) || is_bool($actual);
self::assertTrue($returnType);
}
public function testGetCommitRangeForTravisCi(): void
{
$method = (new ReflectionClass(CodeCoverageCommands::class))->getMethod('getCommitRangeForTravisCi');
$method->setAccessible(true);
$actual = $method->invoke(
self::$testClass
);
$returnType = is_string($actual) || is_array($actual) || is_bool($actual);
self::assertTrue($returnType);
}
public function testGetCodeCoverageCommand(): void
{
$commandExpected = './vendor/bin/phpunit --configuration ./tests/phpunit.xml.dist --coverage-clover ./tests/_output/coverage.xml ./tests/unit/phpunit';
// Run tests
$method = (new ReflectionClass(CodeCoverageCommands::class))->getMethod('getCodeCoverageCommand');
$method->setAccessible(true);
$actual = $method->invoke(
self::$testClass
);
self::assertEquals($commandExpected, $actual);
}
}