Add support for installing Pest into a Lumen application

This entails creating Laravel and Lumen-specific stubs, and ensuring
that the appropriate stubs are copied as part of the pest install.
This commit is contained in:
Michael Dyrynda
2020-05-23 20:52:15 +09:30
parent ce14ffd49a
commit 4496e9d9ee
7 changed files with 44 additions and 2 deletions

11
stubs/Lumen/Helpers.php Normal file
View File

@ -0,0 +1,11 @@
<?php
use Illuminate\Contracts\Auth\Authenticatable;
/**
* Set the currently logged in user for the application.
*/
function actingAs(Authenticatable $user, string $driver = null): TestCase
{
return test()->actingAs($user, $driver);
}

3
stubs/Lumen/Pest.php Normal file
View File

@ -0,0 +1,3 @@
<?php
uses(TestCase::class);

17
stubs/Lumen/phpunit.xml Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Application Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
</phpunit>