Skip to content

Commit

Permalink
Merge pull request #3 from RootStudio/php-updates
Browse files Browse the repository at this point in the history
Updates pacakges for php8.0 and adds BASE_PUBLIC_PATH for wp installs
  • Loading branch information
tidygraphic authored Aug 8, 2022
2 parents ef6f4b4 + 29d8915 commit c8055a0
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 33 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.idea
.DS_Store
composer.lock
vendor
vendor
.phpunit.result.cache
phpunit.xml.bak
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
}
],
"require": {
"php": ">=7.0.0",
"php": ">=7.0.0 || >=8.0",
"nesbot/carbon": "^1.22",
"danielstjules/stringy": "^3.0",
"fzaninotto/faker": "^1.7"
"danielstjules/stringy": "^3.0"
},
"autoload": {
"psr-4": {
Expand All @@ -24,7 +23,8 @@
]
},
"require-dev": {
"phpunit/phpunit": "^6.3",
"mockery/mockery": "^0.9.9"
"phpunit/phpunit": "^9.0",
"mockery/mockery": "^0.9.9",
"fakerphp/faker": "^1.20"
}
}
5 changes: 4 additions & 1 deletion helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
if (!function_exists('base_public_path')) {
function base_public_path(string $path = ''): string
{
$Base = new Base(realpath(__DIR__ . '/../../../../'));
if (!defined('BASE_PUBLIC_PATH')) {
define('BASE_PUBLIC_PATH', '/../../../../');
}
$Base = new Base(realpath(__DIR__ . BASE_PUBLIC_PATH));

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

Expand Down
32 changes: 12 additions & 20 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<php>
<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">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<php>
</php>
</phpunit>
8 changes: 4 additions & 4 deletions tests/HelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public function public_path_returns_valid_path()
{
$result = base_public_path();

$this->assertInternalType('string', $result);
$this->assertIsString( $result);
$this->assertEquals(__DIR__, $result);
}

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

$this->assertInternalType('string', $result);
$this->assertIsString($result);
$this->assertEquals(__DIR__ . '/my_directory', $result);
}

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

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

parent::setUp();
}

public function tearDown()
public function tearDown() : void
{
Mockery::close();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/LayoutsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ public function it_will_return_if_variable_exists_only_in_child_layout()
$this->assertEquals('Hello World', $result);
}

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

parent::setUp();
}

public function tearDown()
public function tearDown() : void
{
Mockery::close();
}
Expand Down

0 comments on commit c8055a0

Please sign in to comment.