Join Joseph Lowery for an in-depth discussion in this video Handling framework assertions, part of Learning Laravel 4 (2014).
To wrap up our tour of unit testing in Laravel,…we'll take a closer look at a key component, assertions.…An assertion is a function that evaluates…a defined condition to see if it's met in a specific way.…If the condition is met, the test succeeds.…If it's not, the test fails.…There are about 90 different assertions…available in PHP Unit.…You can find a full descriptive list…of them on the PHP Unit site.…In this lesson, we'll build out…a number of tests for the key ones.…
In the previous lesson with the test…we created, you saw assertTrue at work.…That's on line 13 in the code.…And, as you might suspect, this assertion gets a lot of use.…Whenever you need to see if a variable evaluates…to true or a function returns true,…assertTrue is the right one to apply.…Naturally, the testing for the opposite…is an equally valid approach, in which…case you want to use assertFalse.…Now before I demonstrate, let me copy…and past this file here, our TrueTest.…
So I'll just copy and paste in a new copy…of it, and I'm going to change this…
- Installing Laravel
- Handling testing
- Establishing an HTML view
- Connecting to a database
- Enabling version control
- Setting up-and-running unit tests
Skill Level Intermediate
1. Introduction to Laravel
2. Creating Initial Laravel Pages
3. Displaying Laravel Code
4. Creating a Laravel Application
5. Testing Your Laravel Code
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.