我有一个基于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)