Skip to content
This repository has been archived by the owner on Feb 19, 2025. It is now read-only.

Commit

Permalink
Passes current request instance into test
Browse files Browse the repository at this point in the history
This will allow access to the current URL for things like tenant resolution, etc
  • Loading branch information
craigpaul committed Sep 10, 2024
1 parent 7e1407f commit b192d4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Http/Controllers/TargetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function store(Request $request): JsonResponse
{
$instance = $this->app->make($request->post('namespace'));

$instance->handle();
$instance->handle($request);

return $this->response->json([
'buckets' => $instance->getBuckets(),
Expand Down
5 changes: 4 additions & 1 deletion tests/CanGenerateTargetsFromWorkflowNamespaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace CraigPaul\Blitz\Tests;

use Illuminate\Http\Request;
use Illuminate\Testing\Fluent\AssertableJson;
use Mockery;
use Mockery\MockInterface;

class CanGenerateTargetsFromWorkflowNamespaceTest extends TestCase
Expand All @@ -13,9 +15,10 @@ public function testCanGenerateTargetsFromAnExistingWorkflowNamespace()

$response = [1, 2, 3];

$this->mock($namespace, function (MockInterface $mock) use ($response) {
$this->mock($namespace, function (MockInterface $mock) use ($namespace, $response) {
$mock = $mock->makePartial()
->shouldReceive('handle')
->with(Mockery::type(Request::class))
->andReturnSelf()
->getMock();

Expand Down

0 comments on commit b192d4e

Please sign in to comment.