Skip to content

Commit 0b2db77

Browse files
authored
Merge pull request #356 from lara-zeus/fix-test
fix test
2 parents fd6cc16 + 6b95f8f commit 0b2db77

File tree

6 files changed

+34
-61
lines changed

6 files changed

+34
-61
lines changed

composer.lock

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpunit.xml.dist

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<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">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/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">
33
<testsuites>
44
<testsuite name="LaraZeus Bolt Test Suite">
55
<directory>tests</directory>
66
</testsuite>
77
</testsuites>
8-
<coverage>
9-
<report>
10-
<html outputDirectory="build/coverage"/>
11-
<text outputFile="build/coverage.txt"/>
12-
<clover outputFile="build/logs/clover.xml"/>
13-
</report>
14-
</coverage>
15-
<logging>
16-
<junit outputFile="build/report.junit.xml"/>
17-
</logging>
188
<php>
19-
<env name="APP_KEY" value="base64:NDNkbDNneml1Y2IxbTgwZnFnM3J4b3czMGhrZG0xdXo="/>
9+
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
2010
<env name="DB_CONNECTION" value="testing"/>
2111
</php>
2212
<source>
2313
<include>
2414
<directory suffix=".php">./src</directory>
2515
</include>
2616
</source>
27-
</phpunit>
17+
</phpunit>

src/BoltPlugin.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ final class BoltPlugin implements Plugin
2929

3030
protected Closure | string $navigationGroupLabel = 'Bolt';
3131

32+
// test hi
33+
3234
public array $defaultGloballySearchableAttributes = [
3335
CategoryResource::class => ['name', 'slug'],
3436
CollectionResource::class => ['name', 'values'],

tests/Pest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
use LaraZeus\Bolt\Tests\TestCase;
44

5-
uses(TestCase::class)->in(__DIR__);
5+
uses(TestCase::class)
6+
->in(__DIR__);

tests/ResourcesTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,9 @@
66

77
use function Pest\Laravel\get;
88

9-
it('can test', function () {
10-
expect(true)->toBeTrue();
11-
});
12-
139
it('can render category list', function () {
14-
get(CategoryResource::getUrl('index'))->assertSuccessful();
15-
16-
get(CategoryResource::getUrl())
17-
->assertSuccessful();
10+
get(CategoryResource::getUrl())
11+
->assertSuccessful();
1812
});
1913

2014
it('can render collection list', function () {

tests/TestCase.php

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,34 @@
1414
use Filament\Tables\TablesServiceProvider;
1515
use Filament\Widgets\WidgetsServiceProvider;
1616
use Guava\FilamentIconPicker\FilamentIconPickerServiceProvider;
17-
use Illuminate\Database\Eloquent\Factories\Factory;
1817
use Illuminate\Foundation\Testing\RefreshDatabase;
1918
use LaraZeus\Bolt\BoltServiceProvider;
2019
use LaraZeus\Bolt\Tests\Models\User;
2120
use LaraZeus\Core\CoreServiceProvider;
2221
use LaraZeus\SEO\SEOServiceProvider;
2322
use Livewire\LivewireServiceProvider;
23+
use Orchestra\Testbench\Attributes\WithMigration;
2424
use Orchestra\Testbench\TestCase as Orchestra;
2525
use RyanChandler\BladeCaptureDirective\BladeCaptureDirectiveServiceProvider;
2626
use secondnetwork\TablerIcons\BladeTablerIconsServiceProvider;
2727

28+
#[WithMigration]
2829
class TestCase extends Orchestra
2930
{
3031
use RefreshDatabase;
3132

32-
protected User $adminUser;
33-
3433
protected function setUp(): void
3534
{
3635
parent::setUp();
3736

38-
$this->withoutExceptionHandling();
39-
4037
$this->actingAs(
4138
User::create(['email' => 'admin@domain.com', 'name' => 'Admin', 'password' => 'password'])
4239
);
40+
}
4341

44-
Factory::guessFactoryNamesUsing(
45-
fn (string $modelName) => 'LaraZeus\\Bolt\\Database\\Factories\\' . class_basename($modelName) . 'Factory'
46-
);
42+
protected function defineDatabaseMigrations(): void
43+
{
44+
$this->loadMigrationsFrom(__DIR__ . '/migrations');
4745
}
4846

4947
protected function getPackageProviders($app): array
@@ -63,23 +61,11 @@ protected function getPackageProviders($app): array
6361
TablesServiceProvider::class,
6462
WidgetsServiceProvider::class,
6563
BladeTablerIconsServiceProvider::class,
66-
6764
AdminPanelProvider::class,
6865
CoreServiceProvider::class,
6966
BoltServiceProvider::class,
7067
SEOServiceProvider::class,
7168
FilamentIconPickerServiceProvider::class,
7269
];
7370
}
74-
75-
protected function defineDatabaseMigrations(): void
76-
{
77-
$this->loadLaravelMigrations();
78-
$this->loadMigrationsFrom(__DIR__ . '/migrations');
79-
}
80-
81-
public function getEnvironmentSetUp($app): void
82-
{
83-
config()->set('database.default', 'testing');
84-
}
8571
}

0 commit comments

Comments
 (0)