public function test_with_valid_params()
 {
     $stub = $this->getStub();
     AuthorizationServer::shouldReceive('checkAuthorizeParams')->once()->andReturn($stub);
     Session::shouldReceive('put')->once();
     $response = $this->getFilter()->filter('', '', null);
     $this->assertNull($response);
 }
 public function testFilter()
 {
     $controllerMock = m::mock('TestingController');
     new \ReflectionClass($controllerMock);
     \Route::shouldReceive('currentRouteAction')->andReturn("TestingController@getTest");
     \Session::shouldReceive('get')->once()->andReturn(true);
     $this->assertNull($this->filter->filter());
 }
Example #3
0
 public function testHandle_withExistingSession()
 {
     $sr = \Mockery::mock(SR::class)->makePartial();
     $a = new A($sr);
     $closure = function ($request) {
         return 2 * $request;
     };
     $sr->shouldReceive('hasActiveSession')->andReturn(TRUE);
     \Session::shouldReceive('get')->with('logged_in')->andReturn(TRUE);
     $r = $a->handle(149, $closure);
     $this->assertSame(2 * 149, $r);
 }
 public function testOnCartAddedWhenInServiceEnvironment()
 {
     //mocks
     $add_profile_mgr_mock = \Mockery::mock('Giftertipster\\Service\\Add\\AddProfileMgrInterface');
     $add_profile_mgr_mock->shouldReceive('getUserAddProfile')->never();
     $this->app->instance('Giftertipster\\Service\\Add\\AddProfileMgrInterface', $add_profile_mgr_mock);
     $add_profile_mgr = \App::make('Giftertipster\\Service\\Add\\AddProfileMgrInterface');
     $sales_agent_mgr = \App::make('Giftertipster\\Service\\SalesAgent\\SalesAgentMgrInterface');
     \App::shouldReceive('environment')->atLeast('once')->andReturn('service');
     \App::shouldReceive('make')->with('Giftertipster\\Service\\Add\\AddProfileMgrInterface')->andReturn($add_profile_mgr);
     \App::shouldReceive('make')->with('Giftertipster\\Service\\SalesAgent\\SalesAgentMgrInterface')->andReturn($sales_agent_mgr);
     \Queue::shouldReceive('push')->never();
     \Session::shouldReceive('get')->never();
     \Session::shouldReceive('put')->never();
     //action
     $this->getEventSub()->onCartAdded(1);
 }