小编Ber*_*ert的帖子

Laravel 5和PHPUnit测试由于未定义索引而失败:REMOTE_ADDR

我有一个基于Laravel 5的网站,并且希望在其上运行PHPUnit测试:为此,我的测试文件夹中包含以下文件:

ExampleTest.php

<?php

use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class ExampleTest extends TestCase
{
    /**
     * A basic functional test example.
     *
     * @return void
     */
    public function testBasicExample()
    {
        $this->visit('/')
             ->see('Laravel 5');
    }
}
Run Code Online (Sandbox Code Playgroud)

NewTest.php

<?

class Example22Test extends TestCase
{

    /**
     * My test implementation
     */
    public function testEncryptionIsIntelligent()
    {
        $this->visit('/')
        ->see('Laravel 5')
        ->visit('/auth/login')
        ->type('test.admin@', 'email')
        ->type('test.admin@eatlaravel.hu', 'email')
        ->type('admin', 'password')
        ->press('')
        ->seePageIs('/admin')
        ->see('Welcome to the dashboard')
        ->visit('/');
    }
}
Run Code Online (Sandbox Code Playgroud)

TestCase.php

<?php

#class TestCase extends Illuminate\Foundation\Testing\TestCase
abstract class …
Run Code Online (Sandbox Code Playgroud)

phpunit undefined laravel

2
推荐指数
1
解决办法
2261
查看次数

标签 统计

laravel ×1

phpunit ×1

undefined ×1