本文介绍了流浪者,代码接受与分析Laravel问题. NotFoundHttpException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 codeception 进行验收测试.

I'm trying to get into using codeception for my acceptance testing.

我的一项测试有以下内容:

I have the following for one of my tests:

<?php
use Codeception\Util\Stub;

class SomeTest extends \Codeception\TestCase\Test
{

    protected $webGuy;

    /**
     * @test
     */
    public function incorrect_login_should_redirect_back()
    {
        $I = $this->webGuy;
        $I->wantTo('fail at logging in');
        $I->amOnPage('/'); // <-- This is the line that is failing
        $I->fillField('email','[email protected]');
        $I->fillField('password','pass');
        $I->click('Login');
        $I->see('email', 'input');
        $I->seeCurrentUrlEquals('/login');
    }

}

最初测试运行正常,但是将Laravel4添加到acceptance.suite.yml文件并运行build之后,测试现在失败,并显示以下内容:

Initially the tests ran OK, however after adding Laravel4 to the acceptance.suite.yml file and running build, the test now fails with the following:

1) SomeTest::incorrect_login_should_redirect_back
Symfony\Component\HttpKernel\Exception\NotFoundHttpException:

#1  /Applications/MAMP/htdocs/hired/vendor/laravel/framework/src/Illuminate/Routing/Router.php:1021
#2  /Applications/MAMP/htdocs/hired/vendor/laravel/framework/src/Illuminate/Routing/Router.php:989
#3  /Applications/MAMP/htdocs/hired/vendor/laravel/framework/src/Illuminate/Routing/Router.php:968
#4  /Applications/MAMP/htdocs/hired/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:738
#5  /Applications/MAMP/htdocs/hired/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:708
#6  /Applications/MAMP/htdocs/hired/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Client.php:81
#7  /Applications/MAMP/htdocs/hired/vendor/symfony/browser-kit/Symfony/Component/BrowserKit/Client.php:325
#8  /Applications/MAMP/htdocs/hired/app/tests/acceptance/WebGuy.php:476
#9  /Applications/MAMP/htdocs/hired/app/tests/acceptance/SomeTest.php:16

我正在使用流浪者在http://localhost:3030/

我已将其设置为acceptance.suite.ymlPhpBrowser配置的网址,如下所示:

I have set this to the url for the PhpBrowser config in acceptance.suite.yml as below:

class_name: WebGuy
modules:
    enabled:
        - PhpBrowser
        - WebHelper
        - Laravel4
    config:
        PhpBrowser:
            url: 'http://localhost:3030/'

我想知道是否还有其他人遇到过这个问题,或者对如何解决这个问题有任何想法,我已经为此花了好几个小时了.

I'm wondering if anybody else has come across this, or has any ideas on how to get around this, I've been tearing my hair out for hours on this.

推荐答案

无法找到解决方案,因此,很遗憾,现在暂时不使用Laravel4模块.

Was not able to find a solution to this, so for now am going to just go without the Laravel4 module, sadly.

这篇关于流浪者,代码接受与分析Laravel问题. NotFoundHttpException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 20:41