I'm starting with tests in Laravel and now i can't reach my tests using phpunit.
The version of Laravel i'm using is 5.0.
OS is centos7 with php 5.6.
So, the first code i wrote is a duplicate of a existent function in the ExampleTest.php file, stored into "tests" folder, like this:
<?php
class ExampleTest extends TestCase {
/**
* A basic functional test example.
*
* @return void
*/
public function testBasicExample()
{
//1 - verificando se a home devolve codigo 200
$response = $this->call('GET', '/');
$this->assertEquals(200, $response->getStatusCode());
}
public function testBasicExample2()
{
//1 - verificando se a home devolve codigo 200
$response = $this->call('GET', '/');
$this->assertEquals(200, $response->getStatusCode());
}
}
This code is only for learning purposes and the goal here is make phpunit run both functions testBasicExample and testBasicExample2.
Te next step is running phpunit. In my case, i had to go to the vendor/phpunit directory and run command "php phpunit". Then, the command returned an error: Laravel 5 Failed opening required bootstrap/../vendor/autoload.php
So, i followed the best answer and i run "composer update" into terminal.
Ok, now i can run "php phpunit", but it run other tests and i can't see my exampletest return.
If some more data is needed, please just ask. Any help is apreciated.
Thanks in advance.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire