Skip to content

Commit

Permalink
Merge pull request #83 from phug-php/fix/non-psr4-files
Browse files Browse the repository at this point in the history
Move compatibility TestCase files outside the autoload folder
  • Loading branch information
kylekatarnls authored May 22, 2021
2 parents 02f4e17 + 7c6ee98 commit 1e19e5b
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 15 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
"./src/Phug/Lexer/",
"./src/Phug/Parser/",
"./src/Phug/Reader/",
"./src/Phug/Renderer/",
"./src/Phug/Util/"
]
"./src/Phug/Renderer/"
],
"Phug\\Util\\": "./src/Phug/Util/Util/"
}
},
"autoload-dev": {
Expand Down
4 changes: 2 additions & 2 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<exclude-pattern>*.js</exclude-pattern>
<exclude-pattern>*/src/Phug/Renderer/Renderer/Adapter/Stream/Template.php</exclude-pattern>
<exclude-pattern>*/src/Phug/Util/Util/TestCase.php</exclude-pattern>
<exclude-pattern>*/src/Phug/Util/Util/TestCaseTyped.php</exclude-pattern>
<exclude-pattern>*/src/Phug/Util/Util/TestCaseUntyped.php</exclude-pattern>
<exclude-pattern>*/src/Phug/Util/CompatibilityUtil/TestCaseTyped.php</exclude-pattern>
<exclude-pattern>*/src/Phug/Util/CompatibilityUtil/TestCaseUntyped.php</exclude-pattern>
</rule>
<file>src</file>
</ruleset>
1 change: 1 addition & 0 deletions src/Phug/Util/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ install:
if [[ "$STYLECHECK" != "on" ]]; then
mkdir -p tests/Phug && \
vendor/bin/split copy https://github.com/phug-php/phug.git tests/Phug/ --filters=tests/Phug/Util;
vendor/bin/split copy https://github.com/phug-php/phug.git compatibility;
fi;
script:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Phug\Util;
namespace Phug\CompatibilityUtil;

use PHPUnit\Framework\TestCase as PHPUnitTestCase;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Phug\Util;
namespace Phug\CompatibilityUtil;

use PHPUnit\Framework\TestCase as PHPUnitTestCase;

Expand Down
2 changes: 1 addition & 1 deletion src/Phug/Util/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Phug Util
=========

What is Phug Lexer?
What is Phug Util?
-------------------

The Phug Util repository contains several utilities to be used in conjunction with Phug libraries.
Expand Down
15 changes: 9 additions & 6 deletions src/Phug/Util/Util/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
namespace Phug\Util;

use PHPUnit\Framework\TestCase as PHPUnitTestCase;
use Phug\CompatibilityUtil\TestCaseTypeBase;
use ReflectionMethod;

$setUp = @new ReflectionMethod(PHPUnitTestCase::class, 'setUp');
$testCaseInitialization = true;
if (!class_exists(TestCaseTypeBase::class)) {
$setUp = @new ReflectionMethod(PHPUnitTestCase::class, 'setUp');
$testCaseInitialization = true;

require $setUp && method_exists($setUp, 'hasReturnType') && $setUp->hasReturnType()
? __DIR__.'/TestCaseTyped.php'
: __DIR__.'/TestCaseUntyped.php';
require $setUp && method_exists($setUp, 'hasReturnType') && $setUp->hasReturnType()
? __DIR__.'/../CompatibilityUtil/TestCaseTyped.php'
: __DIR__.'/../CompatibilityUtil/TestCaseUntyped.php';

unset($testCaseInitialization);
unset($testCaseInitialization);
}

class TestCase extends TestCaseTypeBase
{
Expand Down
2 changes: 1 addition & 1 deletion src/Phug/Util/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"autoload": {
"psr-4": {
"Phug\\": ""
"Phug\\Util\\": "Util/"
}
},
"extra": {
Expand Down

0 comments on commit 1e19e5b

Please sign in to comment.