Skip to content

Commit 3e7f08f

Browse files
Refactor PHPStan config and add test setup scaffolding
Updated the PHPStan configuration to replace an ignored error identifier. Introduced a new testing framework setup including a base `TestCase` class and configuration for test environment and database handling.
1 parent 15f4108 commit 3e7f08f

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

phpstan.neon.dist

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ includes:
44
parameters:
55
ignoreErrors:
66
-
7-
identifier: trait.unused
7+
identifier: property.notFound
88
level: 5
99
paths:
1010
- src

tests/Pest.php

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
use Illuminate\Foundation\Testing\RefreshDatabase;
4+
use JeffersonGoncalves\WhatsappWidget\Tests\TestCase;
5+
6+
uses(TestCase::class, RefreshDatabase::class)->in(__DIR__);

tests/TestCase.php

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace JeffersonGoncalves\WhatsappWidget\Tests;
4+
5+
use Illuminate\Database\Eloquent\Factories\Factory;
6+
use JeffersonGoncalves\WhatsappWidget\WhatsappWidgetServiceProvider;
7+
use Orchestra\Testbench\TestCase as Orchestra;
8+
9+
class TestCase extends Orchestra
10+
{
11+
protected function setUp(): void
12+
{
13+
parent::setUp();
14+
15+
Factory::guessFactoryNamesUsing(
16+
fn (string $modelName) => 'JeffersonGoncalves\\WhatsappWidget\\Database\\Factories\\'.class_basename($modelName).'Factory'
17+
);
18+
}
19+
20+
protected function getPackageProviders($app)
21+
{
22+
return [
23+
WhatsappWidgetServiceProvider::class,
24+
];
25+
}
26+
27+
public function getEnvironmentSetUp($app)
28+
{
29+
config()->set('database.default', 'testing');
30+
31+
/*
32+
$migration = include __DIR__.'/../database/migrations/create_laravel-created-by_table.php.stub';
33+
$migration->up();
34+
*/
35+
}
36+
}

0 commit comments

Comments
 (0)