Testing Laravel's core is a critical part of making and submitting changes to the codebase. Without testing it's incredibly difficult to know if your changes break something. It's possible that your seemingly perfect modification could cause an error in something obscure that few people would ever use. It's important to test for an increased level of confidence.
A few preparations must be made when unit testing Laravel's core in Windows. In the video I walk through updating PEAR, PHPUnit, enabling the fileinfo PHP extension, and pulling down the framework / core tests.
Clone the Laravel framework.
git clone https://github.com/laravel/laravel.git
Clone the laravel-tests bundle into the bundles folder.
cd laravel/bundles
git clone https://github.com/laravel/tests.git laravel-tests
Change directories to your PHP installation folder.
cd xampp177/php
Upgrade PEAR.
pear upgrade pear
Upgrade PHPUnit.
pear upgrade phpunit/PHPUnit
Laravel's File class uses the fileinfo extension. This is generally not enabled by default in Windows packages.
In your php.ini file find the following line.
;extension=php_fileinfo.dll
Uncomment the extension by removing the semi-colon.
extension=php_fileinfo.dll
Then restart your apache.
Change directories into the folder that you cloned Laravel into.
cd laravel
Then, run the tests against the core.
php artisan test:core
Using Laravel and Eloquent I explain Mass-assignment and how it can create an easily exploitable security-hole in your code.
I have modified Eloquent to add mass-assignment white-list functionality and have submitted the following pull-request: https://github.com/taylorotwell/eloquent/pull/19
Edit: this functionality has been merged into Eloquent
This screencast is the sixth in a series utilizing CodeIgniter 2 (Reactor) and PHP ActiveRecord. I'm fundamentally focusing on PHP ActiveRecord due to the dramatic improvement it provides over raw CI models. I'm using Sparks (getsparks.org) in order to install extensions that will be used throughout this series as I think that it's a system with merit that should be utilized at every opportunity.
In this episode we go discuss creating input forms, using flashdata, validating data at the model level, accessible attributes, and a number of other concepts.
Be sure to watch in HD.
In this episode we'll start creating associations between models by creating a belongs_to / has_many relationship between users and blog posts and we'll talk about accessing the related data in multiple ways. We'll also discuss the N+1 query problem and how to resolve it using PHP-ActiveRecord.
Be sure to watch in HD.
In this episode we'll take a few minutes to improve the infrastructure of the project. We'll add functionality that will allow our controller to automatically determine which content view should be loaded. We'll also add the ability to have multiple application layouts (aka templates) and to be able to easily switch between them.
Be sure to watch in HD.
In this episode we'll use the user model that we created to enable our users to login to our site. We'll refactor the user model a bit, extend the CI_Controller class, and create the forms necessary to have a completely working login system.
Be sure to watch in HD.