Laravel Classroom image

Prashant  Nigam / Student / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3 | 4|Last
Lessons:-Unit Testing

16.3 Running Tests
Tests can be ran using the Artisan command line interface. Simply use the test command to
run all test cases.
1 php artisan test
and the result..
1 PHPUnit 3.6.10 by Sebastian Bergmann.
2
3 Configuration read from /home/daylerees/www/laravel/develop/phpunit.xml
4
5 .
6
7 Time: 0 seconds, Memory: 6.25Mb
8
9 OK (1 test, 1 assertion)
With the OK part appearing in bright green to show us that the tests have passed.
Of course we knew that the test would succeed because we are using the assertTrue() method
to check the value true. There is no way it could fail.
Let’s bully the test so that it will fail, we will simply change the parameter to false.
1 ...
2 $this->assertTrue(false);
3 ...
and the result :1 PHPUnit 3.6.10 by Sebastian Bergmann.
2
3 Configuration read from /home/daylerees/www/laravel/develop/phpunit.xml
4
5 F
6
7 Time: 0 seconds, Memory: 6.50Mb
8
9 There was 1 failure:
10
11 1) TestExample::testSomethingIsTrue
12 Failed asserting that false is true.
13
14 /home/daylerees/www/laravel/develop/application/tests/example.test.php:12
15 /usr/bin/phpunit:46
16
17 FAILURES!
18 Tests: 1, Assertions: 1, Failures: 1.
Now we have some bright red lines to indicate that the tests have failed, including some details
about why the test failed.
If we wanted to test a bundle we would simply pass the bundle name as a parameter to the test
command, for example.
1 php artisan test mybundle

 
 
 

Prashant  Nigam

Skills    Laravel

Qualifications :-
Location :-,,,
Description:-
Explore
 

  Students (0)