Skip to content

Commit

Permalink
Merge branch 'main' of github.com:NativePHP/laravel
Browse files Browse the repository at this point in the history
  • Loading branch information
mpociot committed Jul 18, 2023
2 parents 393aecc + 1a0ed8f commit bdde66b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
16 changes: 9 additions & 7 deletions tests/Http/Controller/DispatchEventFromAppControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

use Illuminate\Support\Facades\Event;

class TestEvent {
public function __construct(public string $test = '') {
class TestEvent
{
public function __construct(public string $test = '')
{

}
}

it('dispatches an event', function() {
it('dispatches an event', function () {
Event::fake();

$this->withoutMiddleware()
Expand All @@ -20,7 +22,7 @@ public function __construct(public string $test = '') {
Event::assertDispatched(TestEvent::class);
});

it('dispatches no event in case it does not exist', function() {
it('dispatches no event in case it does not exist', function () {
Event::fake();

$this->withoutMiddleware()
Expand All @@ -31,15 +33,15 @@ public function __construct(public string $test = '') {
Event::assertNotDispatched(InvalidEvent::class);
});

it('passes the payload to the event', function() {
it('passes the payload to the event', function () {
Event::fake();

$this->withoutMiddleware()
->post('_native/api/events', [
'event' => TestEvent::class,
'payload' => [
'test' => 'Some payload string'
]
'test' => 'Some payload string',
],
]);

Event::assertDispatched(TestEvent::class, function ($event) {
Expand Down
8 changes: 5 additions & 3 deletions tests/Http/Controller/NativeAppBootedControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
use Illuminate\Support\Facades\Event;
use Native\Laravel\Events\App\ApplicationBooted;

class TestProvider {
public function boot() {
class TestProvider
{
public function boot()
{

}
}
Expand All @@ -13,7 +15,7 @@ public function boot() {
Event::fake();

config([
'nativephp.provider' => TestProvider::class
'nativephp.provider' => TestProvider::class,
]);

$this->withoutMiddleware()
Expand Down
1 change: 0 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Native\Laravel\Tests;

use Illuminate\Database\Eloquent\Factories\Factory;
use Native\Laravel\NativeServiceProvider;
use Orchestra\Testbench\TestCase as Orchestra;

Expand Down

0 comments on commit bdde66b

Please sign in to comment.