Laravel Classroom image

Anil  Bist / Professional / Web Technology

 
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³.

 
 
 
image
Anil  Bist

Skills    Laravel

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-

I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore

 

  Students (0)