php - Laravel app boostraps 在测试环境的早期

标签 php laravel testing laravel-socialite

正常情况下,申请是bootstrapped after请求 created .但是在测试环境中它发生了before创建请求。

这导致 socialiteproviders/manager 隐式创建 request here ,认为它已经存在。此请求未被使用,并且 the other one是在那之后创建的。

因此,我无法使用 withSession helper 伪造 session 数据.因为它改变了为后面的请求创建的 session 。 SocialiteProviders 的提供者总是得到空 session 。

如果我禁用引导它 here ,我得到的第一个错误是 at this line ,因为应用程序尚未启动。

谁的错?以及如何解决?同时您能想到任何解决方法吗?

附言更多详情 here .

最佳答案

好吧,如果我必须回答谁有错,我会说是 socialiteproviders/manager,因为它假定在引导应用程序时已经创建了请求。这是the solution我的看法。

要使用它你添加

{
    "type": "vcs",
    "url": "https://github.com/x-yuri/Manager"
}

composer.jsonrepositories 参数。做

$ composer require 'socialiteproviders/manager=dev-testing-boot as 2.2.1'

不过请注意,使用额外的存储库会减慢 composer 的速度。

关于php - Laravel app boostraps 在测试环境的早期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41271826/

相关文章:

c# - 存储库模式 - 切换出数据库并切换到 XML 文件

php - 在 Laravel 项目中为评论创建 Like 系统时遇到问题

php - Twitter 搜索 API,如何通过@username 进行过滤?

php - UserController.php 中的 FatalErrorException 第 39 行 : Class 'App\Http\Controllers\User' not found

laravel - Elasticquent/elasticquent是否与laravel 7兼容?

mysql - 如何为数据库中的现有用户上传文件并在 laravel 5.4 中为他们创建文件夹

php - 使用 SYmfony 在 PHP 中处理 "Undefined Index"

PHP OCI8 扩展不适用于 PHP 7 64 位

testing - 如何在 karma 测试中通过 AngularJS $scope

java - Selenium 测试用例执行速度问题