When I run program below,error has occured.
(i) In Cloud9, install laravel
(ii) copy "./app/Http/route.php" to "./app/Http/route_a.php" add some lines in route_a.php
Route::get('/test/', function () {
echo 'test';
});
(iii) I edit "./tests/ExampleTest.php".
<?php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Filesystem\Filesystem;
class ExampleTest extends TestCase
{
/**
* A basic functional test example.
*
* @return void
*/
public function testBasicExample()
{
$this->editRoute();
$this->visit('/')
->see('Laravel 5');
$this->visit('http://ift.tt/23dCume');
}
private function editRoute(){
$this->files = new Filesystem;
$this->files->move( './app/Http/routes.php', './app/Http/routes_b.php');
$this->files->move( './app/Http/routes_a.php', './app/Http/routes.php');
Artisan::call('clear-compiled');
Artisan::call('cache:clear');
}
}
(iv) run phpunit
php ./vendor/bin/phpunit
And error has occured below.
There was 1 failure:
1) ExampleTest::testBasicExample
A request to [http://localhost/test] failed. Received status code [404].
After error, commentout "editRoute()", and run phpunit again, then there is no error.
Please Someone help me. Thank you.
Aucun commentaire:
Enregistrer un commentaire