用于SSO NotFoundHttpException的Laravel集成测试

时间:2018-04-02 03:08:58

标签: laravel single-sign-on integration-testing

我的集成测试需要帮助。我在localhost上有一个项目,在localhost:8081端口上有SSO。当我为SSO更改base_url并发送请求时,它会抛出异常,因为登录页面的路由不在本地项目中但在SSO内部。如何一起测试外部SSO和本地项目?

 public function testLogin() 
 {
   config(['app.url' => 'http://192.168.33.11:8081']);

   $this->visit('/login?service_id=2')
       ->type('name', 'name')
       ->type('password', 'password');
       ->press('Log in')
       ->see('dashboard')
       ->onPage('dashboard.index');
  }

和例外

  There was 1 failure:
  1) ExampleTest::testLogin
  A request to [http://192.168.33.11:8081/login?service_id=2] failed. 
  Received status code [404].
  Caused by
  Symfony\Component\HttpKernel\Exception\NotFoundHttpException in 
  C:\...vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php:161

0 个答案:

没有答案