Skip to content

Commit 750b863

Browse files
Refactor autoloading (#198)
* Use PSR-4 autoloading for tests * Use PSR-4 for source
1 parent 7b43d72 commit 750b863

17 files changed

+34
-21
lines changed

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,15 @@
3737
"friendsofphp/php-cs-fixer": "^2.7"
3838
},
3939
"autoload": {
40-
"psr-0": {
40+
"psr-4": {
4141
"Pdp\\": "src/"
4242
}
4343
},
44+
"autoload-dev": {
45+
"psr-4": {
46+
"Pdp\\Tests\\": "tests/"
47+
}
48+
},
4449
"scripts": {
4550
"post-install-cmd": "php bin/update-psl",
4651
"pcf": "php-cs-fixer fix --verbose"

phpunit.xml.dist

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
<phpunit
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.3/phpunit.xsd"
5-
bootstrap="tests/bootstrap.php"
5+
bootstrap="vendor/autoload.php"
66
colors="true">
77

8+
<php>
9+
<ini name="error_reporting" value="-1" />
10+
</php>
11+
812
<testsuite name="php-domain-parser">
9-
<directory>tests/src</directory>
13+
<directory>./tests</directory>
1014
</testsuite>
1115

1216
<filter>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/Pdp/PublicSuffixList.php renamed to src/PublicSuffixList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct($rules = null)
4646
private function filterRules($rules): array
4747
{
4848
if ($rules === null) {
49-
return include dirname(__DIR__, 2) . '/data/public-suffix-list.php';
49+
return include dirname(__DIR__) . '/data/public-suffix-list.php';
5050
}
5151

5252
if (is_array($rules)) {

src/Pdp/PublicSuffixListManager.php renamed to src/PublicSuffixListManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class PublicSuffixListManager
6565
*/
6666
public function __construct(string $cacheDir = null)
6767
{
68-
$this->cacheDir = $cacheDir ?? realpath(dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'data');
68+
$this->cacheDir = $cacheDir ?? realpath(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'data');
6969
}
7070

7171
/**

0 commit comments

Comments
 (0)