Skip to content

Commit 29dddd4

Browse files
committed
Making tests green again.
Signed-off-by: Jason Lewis <[email protected]>
1 parent b7c4d34 commit 29dddd4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/DispatcherTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ public function setUp()
99
{
1010
$this->request = new Illuminate\Http\Request;
1111
$this->router = m::mock('Dingo\Api\Routing\Router');
12-
$this->dispatcher = new Dingo\Api\Dispatcher($this->request, $this->router);
12+
$this->auth = m::mock('Dingo\Api\Authentication');
13+
$this->dispatcher = new Dingo\Api\Dispatcher($this->request, $this->router, $this->auth);
1314
}
1415

1516

@@ -28,6 +29,8 @@ public function testInternalRequests()
2829
$this->router->shouldReceive('getApiCollection')->times(6)->with('v1')->andReturn(new Dingo\Api\Routing\ApiCollection('v1', ['prefix' => 'api']));
2930
$this->router->shouldReceive('enableApiRouting')->times(6);
3031

32+
$this->auth->shouldReceive('setUser')->times(6)->with(null);
33+
3134
$this->assertEquals('test', $this->dispatcher->get('test'));
3235
$this->assertEquals('test', $this->dispatcher->post('test'));
3336
$this->assertEquals('test', $this->dispatcher->put('test'));
@@ -45,6 +48,8 @@ public function testInternalRequestWithVersionAndParameters()
4548
$this->router->shouldReceive('getApiCollection')->once()->with('v1')->andReturn(new Dingo\Api\Routing\ApiCollection('v1', ['prefix' => 'api']));
4649
$this->router->shouldReceive('enableApiRouting')->once();
4750

51+
$this->auth->shouldReceive('setUser')->once()->with(null);
52+
4853
$this->assertEquals('test', $this->dispatcher->version('v1')->with(['foo' => 'bar'])->get('test'));
4954
}
5055

@@ -58,6 +63,8 @@ public function testInternalRequestWithPrefixAndDomain()
5863
$this->router->shouldReceive('getApiCollection')->once()->with('v1')->andReturn(new Dingo\Api\Routing\ApiCollection('v1', ['domain' => 'testing']));
5964
$this->router->shouldReceive('enableApiRouting')->once();
6065

66+
$this->auth->shouldReceive('setUser')->once()->with(null);
67+
6168
$this->assertEquals('test', $this->dispatcher->get('test'));
6269
}
6370

@@ -74,6 +81,8 @@ public function testInternalRequestThrowsException()
7481
$this->router->shouldReceive('getApiCollection')->once()->with('v1')->andReturn(new Dingo\Api\Routing\ApiCollection('v1', ['domain' => 'testing']));
7582
$this->router->shouldReceive('enableApiRouting')->once();
7683

84+
$this->auth->shouldReceive('setUser')->once()->with(null);
85+
7786
$this->dispatcher->get('test');
7887
}
7988

0 commit comments

Comments
 (0)