Skip to content

Commit c8055a0

Browse files
authored
Merge pull request #3 from RootStudio/php-updates
Updates pacakges for php8.0 and adds BASE_PUBLIC_PATH for wp installs
2 parents ef6f4b4 + 29d8915 commit c8055a0

6 files changed

Lines changed: 30 additions & 33 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.idea
22
.DS_Store
33
composer.lock
4-
vendor
4+
vendor
5+
.phpunit.result.cache
6+
phpunit.xml.bak

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@
1010
}
1111
],
1212
"require": {
13-
"php": ">=7.0.0",
13+
"php": ">=7.0.0 || >=8.0",
1414
"nesbot/carbon": "^1.22",
15-
"danielstjules/stringy": "^3.0",
16-
"fzaninotto/faker": "^1.7"
15+
"danielstjules/stringy": "^3.0"
1716
},
1817
"autoload": {
1918
"psr-4": {
@@ -24,7 +23,8 @@
2423
]
2524
},
2625
"require-dev": {
27-
"phpunit/phpunit": "^6.3",
28-
"mockery/mockery": "^0.9.9"
26+
"phpunit/phpunit": "^9.0",
27+
"mockery/mockery": "^0.9.9",
28+
"fakerphp/faker": "^1.20"
2929
}
3030
}

helpers.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
if (!function_exists('base_public_path')) {
1414
function base_public_path(string $path = ''): string
1515
{
16-
$Base = new Base(realpath(__DIR__ . '/../../../../'));
16+
if (!defined('BASE_PUBLIC_PATH')) {
17+
define('BASE_PUBLIC_PATH', '/../../../../');
18+
}
19+
$Base = new Base(realpath(__DIR__ . BASE_PUBLIC_PATH));
1720

1821
$userPath = $Base->getPublicPath() . ($path ? '/' . trim($path, '/') : $path);
1922

phpunit.xml

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
4-
bootstrap="vendor/autoload.php"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false">
11-
<testsuites>
12-
<testsuite name="default">
13-
<directory suffix="Test.php">./tests</directory>
14-
</testsuite>
15-
</testsuites>
16-
<filter>
17-
<whitelist processUncoveredFilesFromWhitelist="true">
18-
<directory suffix=".php">./src</directory>
19-
</whitelist>
20-
</filter>
21-
<php>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./src</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="default">
10+
<directory suffix="Test.php">./tests</directory>
11+
</testsuite>
12+
</testsuites>
13+
<php>
2214
</php>
2315
</phpunit>

tests/HelpersTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public function public_path_returns_valid_path()
99
{
1010
$result = base_public_path();
1111

12-
$this->assertInternalType('string', $result);
12+
$this->assertIsString( $result);
1313
$this->assertEquals(__DIR__, $result);
1414
}
1515

@@ -20,7 +20,7 @@ public function public_path_can_be_appended_to()
2020
{
2121
$result = base_public_path('/my_directory');
2222

23-
$this->assertInternalType('string', $result);
23+
$this->assertIsString($result);
2424
$this->assertEquals(__DIR__ . '/my_directory', $result);
2525
}
2626

@@ -83,15 +83,15 @@ public function it_will_output_ssl_protocol_on_http_host()
8383
$this->assertEquals('https://' . $host, $result);
8484
}
8585

86-
public function setUp()
86+
public function setUp() : void
8787
{
8888
$externalMock = Mockery::mock('overload:RootStudio\Base');
8989
$externalMock->shouldReceive('getPublicPath')->andReturn(__DIR__);
9090

9191
parent::setUp();
9292
}
9393

94-
public function tearDown()
94+
public function tearDown() : void
9595
{
9696
Mockery::close();
9797
}

tests/LayoutsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,15 @@ public function it_will_return_if_variable_exists_only_in_child_layout()
162162
$this->assertEquals('Hello World', $result);
163163
}
164164

165-
public function setUp()
165+
public function setUp() : void
166166
{
167167
$externalMock = Mockery::mock('overload:RootStudio\Base');
168168
$externalMock->shouldReceive('getLayoutPath')->once()->andReturn(__DIR__ . '/stubs');
169169

170170
parent::setUp();
171171
}
172172

173-
public function tearDown()
173+
public function tearDown() : void
174174
{
175175
Mockery::close();
176176
}

0 commit comments

Comments
 (0)