jarektkaczyk / laravel-kahlan

Laravel context for kahlan specs/tests - allows nice BDD way of developing Laravel app. https://softonsofa.com
16 stars 10 forks source link

Sofa/laravel-kahlan

Kahlan suite for testing Laravel application providing intuitive kahlan (jasmine based) describe-it syntax with Laravel functional testing goodies.

See usage example on https://github.com/jarektkaczyk/kahlan-driven-laravel

Why I should use the package & how it works?

Take a look at the example spec

First use in 3 steps

  1. Add to your project

    composer require --dev sofa/laravel-kahlan:"~5.4"
  2. Add this line to your kahlan config file (create it if necessary):

    /*  /path/to/your/app/kahlan-config.php  */
    <?php
    
    Sofa\LaravelKahlan\Env::bootstrap($this);
    
  3. Create your first spec in /spec folder, for example /spec/AppSpec.php and run test suite with vendor/bin/kahlan. Working example can be found on https://github.com/jarektkaczyk/kahlan-driven-laravel

    /*  /path/to/your/app/spec/AppSpec.php  */
    <?php
    
    describe('My awesome Kahlan driven Laravel app', function () {
        it("provides the same testing API as Laravel's own TestCase", function () {
            $this->laravel->get('/')
                          ->assertSee('Laravel 5')
                          ->assertStatus(200);
        });
    }
    

Optional stuff


Happy coding!