generated from filamentphp/plugin-skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat(tests): added test setup and PHPUnit configuration
Added autoload for tests and comprehensive testing suite with PHPUnit support.
- Loading branch information
1 parent
c6cdb17
commit 091f20d
Showing
7 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ phpunit.xml | |
phpstan.neon | ||
testbench.yaml | ||
vendor | ||
/.phpunit.cache/test-results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" | ||
backupGlobals="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
executionOrder="random" | ||
failOnWarning="true" | ||
failOnRisky="true" | ||
failOnEmptyTestSuite="true" | ||
beStrictAboutOutputDuringTests="true" | ||
cacheDirectory=".phpunit.cache" | ||
backupStaticProperties="false" | ||
> | ||
<testsuites> | ||
<testsuite name="ChrisReedIO Test Suite"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<coverage> | ||
<report> | ||
<html outputDirectory="build/coverage"/> | ||
<text outputFile="build/coverage.txt"/> | ||
<clover outputFile="build/logs/clover.xml"/> | ||
</report> | ||
</coverage> | ||
<logging> | ||
<junit outputFile="build/report.junit.xml"/> | ||
</logging> | ||
<source> | ||
<include> | ||
<directory suffix=".php">./src</directory> | ||
</include> | ||
</source> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
it('will not use debugging functions') | ||
->expect(['dd', 'dump', 'ray']) | ||
->each->not->toBeUsed(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
it('can test', function () { | ||
expect(true)->toBeTrue(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
use ChrisReedIO\BreakpointBadge\Tests\TestCase; | ||
|
||
uses(TestCase::class)->in(__DIR__); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace ChrisReedIO\BreakpointBadge\Tests; | ||
|
||
use BladeUI\Heroicons\BladeHeroiconsServiceProvider; | ||
use BladeUI\Icons\BladeIconsServiceProvider; | ||
use Filament\Actions\ActionsServiceProvider; | ||
use Filament\FilamentServiceProvider; | ||
use Filament\Forms\FormsServiceProvider; | ||
use Filament\Infolists\InfolistsServiceProvider; | ||
use Filament\Notifications\NotificationsServiceProvider; | ||
use Filament\Support\SupportServiceProvider; | ||
use Filament\Tables\TablesServiceProvider; | ||
use Filament\Widgets\WidgetsServiceProvider; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
use Livewire\LivewireServiceProvider; | ||
use Orchestra\Testbench\TestCase as Orchestra; | ||
use RyanChandler\BladeCaptureDirective\BladeCaptureDirectiveServiceProvider; | ||
|
||
class TestCase extends Orchestra | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
Factory::guessFactoryNamesUsing( | ||
fn (string $modelName) => 'ChrisReedIO\\BreakpointBadge\\Database\\Factories\\' . class_basename($modelName) . 'Factory' | ||
); | ||
} | ||
|
||
protected function getPackageProviders($app) | ||
{ | ||
return [ | ||
ActionsServiceProvider::class, | ||
BladeCaptureDirectiveServiceProvider::class, | ||
BladeHeroiconsServiceProvider::class, | ||
BladeIconsServiceProvider::class, | ||
FilamentServiceProvider::class, | ||
FormsServiceProvider::class, | ||
InfolistsServiceProvider::class, | ||
LivewireServiceProvider::class, | ||
NotificationsServiceProvider::class, | ||
SupportServiceProvider::class, | ||
TablesServiceProvider::class, | ||
WidgetsServiceProvider::class, | ||
]; | ||
} | ||
|
||
public function getEnvironmentSetUp($app) | ||
{ | ||
config()->set('database.default', 'testing'); | ||
|
||
/* | ||
$migration = include __DIR__.'/../database/migrations/create_socialment_table.php.stub'; | ||
$migration->up(); | ||
*/ | ||
} | ||
} |