mardi 27 janvier 2015

How can I do unit and database testing on a Laravel 4 package?

I am developing a package link here for Laravel 4.2. I want to write unit tests and database tests. As far I read I have to create an instance of Laravel app in order to use all the features in testing.


I did a modification on composer.json and added the Laravel package like this



"require-dev": {
"phpunit/phpunit" : "4.*",
"laravel/laravel": "4.2.*"
},


After composer update I created a TestCase class like the one from Laravel



public function createApplication()
{
$unitTesting = true;
$testEnvironment = 'testing';
return require __DIR__.'/../vendor/laravel/laravel/bootstrap/start.php';
}


The issue is when doing a require in start.php I have an error with creating the framework with path ./vjroby/laravel-nonce/vendor/laravel/laravel/vendor/laravel/framework/src


because there is not such file, the file is in ./vjroby/laravel-nonce/vendor/laravel/framework/src


Aucun commentaire:

Enregistrer un commentaire