Skip to content

Commit

Permalink
webhook working need to merge
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Jun 12, 2023
1 parent c3a1e0d commit 34e90f8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 0 additions & 2 deletions app/Listeners/RunTransformersListener.php
Expand Up @@ -3,8 +3,6 @@
namespace App\Listeners;

use App\Events\SourceRunCompleteEvent;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;

class RunTransformersListener
{
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Source.php
Expand Up @@ -46,7 +46,7 @@ public function documents()
/**
* @throws SourceTypeMissingException
*/
public function run(array $payload = []) : Document
public function run(array $payload = []): Document
{
try {
$sourceType = $this->getSourceTypeClass();
Expand Down
4 changes: 2 additions & 2 deletions app/Providers/EventServiceProvider.php
Expand Up @@ -21,8 +21,8 @@ class EventServiceProvider extends ServiceProvider
SendEmailVerificationNotification::class,
],
SourceRunCompleteEvent::class => [
RunTransformersListener::class
]
RunTransformersListener::class,
],
];

/**
Expand Down
Expand Up @@ -2,11 +2,13 @@

namespace Tests\Feature\Http\Controllers;

use App\Events\SourceRunCompleteEvent;
use App\Jobs\ProcessSourceJob;
use App\Models\Project;
use App\Models\Source;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Queue;
use Tests\TestCase;
Expand Down Expand Up @@ -120,6 +122,7 @@ public function testCreateWebHook()
public function test_api()
{
Http::fake();
Event::fake();
$data = get_fixture('github_webhook.json');
$source = Source::factory()->webFileMetaData()->create();
$this->post(route('api.sources.webhook', [
Expand All @@ -129,5 +132,6 @@ public function test_api()
->assertStatus(200);

Http::assertSentCount(1);
Event::assertDispatched(SourceRunCompleteEvent::class);
}
}
8 changes: 3 additions & 5 deletions tests/Feature/Listeners/RunTransformersListenerTest.php
Expand Up @@ -2,14 +2,12 @@

namespace Tests\Feature\Listeners;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;

class RunTransformersListenerTest extends TestCase
{

public function test_runs_transformers() {
$this->markTestSkipped("@TODO oops wrong branch");
public function test_runs_transformers()
{
$this->markTestSkipped('@TODO oops wrong branch');
}
}

0 comments on commit 34e90f8

Please sign in to comment.