Laravel Classroom image

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

16.2 Creating a Test
Let’s take a look at a test case, fortunately Laravel has included an example test case for us!
1 <?php
2
3 // application/tests/example.test.php
4
5 class TestExample extends PHPUnit_Framework_TestCase {
6
7 /**
8 * Test that a given condition is met.
9 *
10 * @return void
11 */
12 public function testSomethingIsTrue()
13 {
14 $this->assertTrue(true);15 }
16
17 }
As you can see we create our test cases in a file with the extension test.php, the name of the
class must start with the word Test and it must extend the class PHPUnit_Framework_TestCase.
These are limitations set not by Laravel, but by the PHPUnit software.
A PHPUnit test case may contain any number of tests, as camel-cased actions, prefixed with the
word test. Our tests can contain a number of different assertions that decide whether our tests
will pass or fail.
A full list of assertions can be found on the PHPUnit documentation website³.

 
 
 

osdyui

Skills    Laravel

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

  Students (0)