Skip to content

Commit

Permalink
Merge pull request #34 from worksome/pest_v2
Browse files Browse the repository at this point in the history
chore(deps): Upgrade to Pest v2
  • Loading branch information
lukeraymonddowning committed Mar 22, 2023
2 parents aa0f4aa + 6f592e2 commit d158621
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 35 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.2]
laravel: [9.*, 10.*]
laravel: [10.*]
stability: [prefer-stable]
include:
- laravel: 9.*
testbench: 7.*
- laravel: 10.*
testbench: 8.*

Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
],
"require": {
"php": "^8.2",
"illuminate/contracts": "^9.46|^10.0",
"illuminate/contracts": "^10.0",
"nikic/php-parser": "^4.15",
"nunomaduro/termwind": "^1.15",
"spatie/laravel-package-tools": "^1.14.1",
"thecodingmachine/safe": "^2.4"
},
"require-dev": {
"nunomaduro/collision": "^6.4",
"nunomaduro/collision": "^7.0",
"nunomaduro/larastan": "^2.4.0",
"orchestra/testbench": "^7.17|^8.0",
"pestphp/pest": "^1.22",
"pestphp/pest-plugin-laravel": "^1.4",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0",
"worksome/coding-style": "^2.3.2"
},
"autoload": {
Expand Down
22 changes: 4 additions & 18 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
executionOrder="random"
failOnWarning="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true"
verbose="true"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
cacheDirectory=".phpunit.cache"
colors="true"
>
<testsuites>
<testsuite name="Worksome Test Suite">
Expand Down
13 changes: 7 additions & 6 deletions src/Actions/ReadEnvironmentFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
use Dotenv\Parser\Entry;
use Dotenv\Parser\Parser;
use Illuminate\Support\Collection;
use Throwable;
use Worksome\Envy\Contracts\Actions\ReadsEnvironmentFile;
use Worksome\Envy\Exceptions\EnvironmentFileNotFoundException;
use Worksome\Envy\Support\EnvironmentVariable;

use function Safe\file_get_contents;

final class ReadEnvironmentFile implements ReadsEnvironmentFile
{
public function __invoke(string $envFilePath): Collection
Expand All @@ -32,10 +29,14 @@ public function __invoke(string $envFilePath): Collection
*/
private function getFileContents(string $envFilePath): string
{
try {
return file_get_contents($envFilePath);
} catch (Throwable) {
if (! file_exists($envFilePath)) {
throw new EnvironmentFileNotFoundException($envFilePath);
}

$content = file_get_contents($envFilePath);

assert($content !== false);

return $content;
}
}
4 changes: 2 additions & 2 deletions tests/Concerns/ResetsTestFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ trait ResetsTestFiles

public function setUpResetsTestFiles(): void
{
if (! in_array('withoutPublishedConfigFile', $this->getGroups())) {
if (! in_array('withoutPublishedConfigFile', $this->groups())) {
// We always want a fresh copy of the envy config file.
copy(__DIR__ . '/../../config/envy.php', testAppPath('config/envy.php'));
}
Expand All @@ -49,7 +49,7 @@ public function tearDownResetsTestFiles(): void
}
}

if (! in_array('withoutPublishedConfigFile', $this->getGroups())) {
if (! in_array('withoutPublishedConfigFile', $this->groups())) {
unlink(testAppPath('config/envy.php'));
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected function setUp(): void
renderUsing(new BufferedOutput());
$this->setUpResetsTestFiles();

if (! in_array('useRealFinder', $this->getGroups())) {
if (! in_array('useRealFinder', $this->groups())) {
$this->app->bind(Finder::class, TestFinder::class);
}
}
Expand Down

0 comments on commit d158621

Please sign in to comment.