Skip to content

Commit

Permalink
Testing fixes missed in L11 upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
JSn1nj4 committed Mar 22, 2024
1 parent dbc1296 commit 7a31adf
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 40 deletions.
56 changes: 29 additions & 27 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
<?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"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./app</directory>
</include>
</coverage>
<php>
<server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>
<server name="MAIL_MAILER" value="array"/>
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>
<server name="TELESCOPE_ENABLED" value="false"/>
</php>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>app</directory>
</include>
</source>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_STORE" value="array"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
<env name="MAIL_MAILER" value="array"/>
<env name="PULSE_ENABLED" value="false"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>
36 changes: 23 additions & 13 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
|
*/

expect()->extend('toBeOne', function () {
return $this->toBe(1);
});
// expect()->extend('toBeOne', function () {
// return $this->toBe(1);
// });

/*
|--------------------------------------------------------------------------
Expand All @@ -52,46 +52,56 @@
|
*/

function createImage(): Image {
function createImage(): Image
{
return Image::factory()->createOne();
}

function createPost(): Post {
function createPost(): Post
{
return Post::factory()->createOne();
}

function createProject(): Project {
function createProject(): Project
{
return Project::factory()->createOne();
}

function createUser(): User {
function createUser(): User
{
return User::factory()->createOne();
}

function hashPassword(string $password): string {
function hashPassword(string $password): string
{
$hashPassword = new \App\Actions\HashPassword();

return $hashPassword($password);
}

function invoke(string $className, array $params): mixed {
function invoke(string $className, array $params): mixed
{
$class = resolve($className);

return $class(...$params);
}

function makeImage(): Image {
function makeImage(): Image
{
return Image::factory()->makeOne();
}

function makePost(): Post {
function makePost(): Post
{
return Post::factory()->makeOne();
}

function makeProject(): Project {
function makeProject(): Project
{
return Project::factory()->makeOne();
}

function makeUser(): User {
function makeUser(): User
{
return User::factory()->makeOne();
}

0 comments on commit 7a31adf

Please sign in to comment.