Skip to content

Commit

Permalink
Move the MakefileTest to the AutoReview namespace (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry authored Dec 7, 2022
1 parent bcddd3b commit 4f1d36e
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 14 deletions.
5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@
"autoload-dev": {
"psr-4": {
"Fidry\\CpuCoreCounter\\Test\\": "tests/"
},
"classmap": [
"stubs"
]
}
},
"config": {
"allow-plugins": {
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
bootstrap="vendor/autoload.php"
bootstrap="tests/bootstrap.php"
failOnRisky="true"
failOnWarning="true"
cacheResultFile=".build/phpunit/.phpunit.result.cache">
Expand Down
2 changes: 1 addition & 1 deletion phpunit_legacy.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
bootstrap="vendor/autoload.php"
bootstrap="tests/bootstrap.php"
failOnRisky="true"
failOnWarning="true"
cacheResultFile=".build/phpunit/.phpunit_legacy.result.cache">
Expand Down
6 changes: 0 additions & 6 deletions stubs/BaseMakefileTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@

namespace Fidry\Makefile\Test;

use Composer\InstalledVersions;
use PHPUnit\Framework\TestCase;

// When testing 7.2 or 7.3, fidry/makefile is not installed hence this stub.
if (InstalledVersions::isInstalled('fidry/makefile')) {
return;
}

/**
* @internal
*/
Expand Down
6 changes: 4 additions & 2 deletions tests/MakefileTest.php → tests/AutoReview/MakefileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Fidry\CpuCoreCounter\Test;
namespace Fidry\CpuCoreCounter\Test\AutoReview;

use Fidry\Makefile\Test\BaseMakefileTestCase;

Expand All @@ -24,7 +24,7 @@ final class MakefileTest extends BaseMakefileTestCase
{
protected static function getMakefilePath(): string
{
return __DIR__.'/../Makefile';
return __DIR__.'/../../Makefile';
}

protected function getExpectedHelpOutput(): string
Expand All @@ -37,6 +37,8 @@ protected function getExpectedHelpOutput(): string
# Commands
#---------------------------------------------------------------------------
default: Runs the default task
diagnose: Executes a diagnosis for all the finders
execute: Executes all the finders
phive: Updates a (registered) tool. E.g. make phive TOOL=infection
cs: Fixes CS
cs_lint: Lints CS
Expand Down
22 changes: 22 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/*
* This file is part of the Fidry CPUCounter Config package.
*
* (c) Théo FIDRY <theo.fidry@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

use Composer\InstalledVersions;

$autoloader = require __DIR__.'/../vendor/autoload.php';

if (!InstalledVersions::isInstalled('fidry/makefile')) {
require_once __DIR__.'/../stubs/BaseMakefileTestCase.php';
}

return $autoloader;

0 comments on commit 4f1d36e

Please sign in to comment.