Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bin/dredd-hooks-laravel
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ if (!$loaded) {

// Laravel will not overwrite existing environment variables, so we'll pull in custom ones here
if (file_exists($basePath . '/.env.dredd')) {
$dotenv = new Dotenv\Dotenv(new \Dotenv\Loader([$basePath . '/.env.dredd'], new \Dotenv\Environment\DotenvFactory()));
$dotenv->overload();
$dotenv = Dotenv\Dotenv::createMutable($basePath, '.env.dredd');
$dotenv->load();
}

// Load Laravel
Expand All @@ -49,7 +49,7 @@ $options = getopt('', [

// Second argument is the single kernel file
$dreddKernelPath = $argv[1];
$parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7);
$parser = (new ParserFactory)->createForNewestSupportedVersion();

try {
$statements = $parser->parse(file_get_contents($dreddKernelPath));
Expand All @@ -60,7 +60,7 @@ try {

try {
if ($statements[0] instanceof PhpParser\Node\Stmt\Namespace_) {
$kernelClass = implode('\\', $statements[0]->name->parts);
$kernelClass = implode('\\', $statements[0]->name->getParts());
foreach ($statements[0]->stmts as $statement) {
if ($statement instanceof PhpParser\Node\Stmt\Class_) {
$kernelClass .= '\\' . $statement->name;
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"description": "Laravel hooks for the Dredd testing tool",
"type": "package",
"require": {
"php": ">=7.1",
"nikic/php-parser": "^4.2",
"ddelnano/dredd-hooks-php": "^1.1"
"php": ">=7.2",
"nikic/php-parser": "^5.0",
"ddelnano/dredd-hooks-php": "^2.0"
},
"license": "MIT",
"authors": [
Expand Down
6 changes: 3 additions & 3 deletions server.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

// Laravel will not overwrite existing environment variables, so we'll pull in custom ones here
if (file_exists($basePath . '/.env.dredd')) {
$dotenv = new Dotenv\Dotenv(new \Dotenv\Loader([$basePath . '/.env.dredd'], new \Dotenv\Environment\DotenvFactory()));
$dotenv->overload();
$dotenv = Dotenv\Dotenv::createMutable($basePath, '.env.dredd');
$dotenv->load();
}

require_once $basePath . '/server.php';
require_once $basePath . '/server.php';
14 changes: 14 additions & 0 deletions src/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@

use Dredd\Hooks;

/**
* Class Kernel
*
* @package Netsells\Dredd
*
* @method Hooks\beforeAll beforeAll(callable $function)
* @method Hooks\beforeEach beforeEach(callable $function)
* @method Hooks\beforeEachValidation beforeEachValidation(callable $function)
* @method Hooks\afterEach afterEach(callable $function)
* @method Hooks\afterAll afterAll(callable $function)
* @method Hooks\before before(string $transactionName, callable $function)
* @method Hooks\beforeValidation beforeValidation(callable $function)
* @method Hooks\after after(string $transactionName, callable $function)
*/
abstract class Kernel
{
use ResolvesArgumentTrait;
Expand Down