2017 © Pedro Peláez
 

library laravel-kahlan

Kahlan specs suite for testing Laravel applications

image

nicard/laravel-kahlan

Kahlan specs suite for testing Laravel applications

  • Wednesday, February 7, 2018
  • by gtilixj
  • Repository
  • 4 Watchers
  • 0 Stars
  • 101 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 0 Open issues
  • 25 Versions
  • 0 % Grown

The README.md

Sofa/laravel-kahlan

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

If I'm saving you some time with my work, you can back me up on Patreon page., (*2)

See usage example on https://github.com/jarektkaczyk/kahlan-driven-laravel, (*3)

Why I should use the package & how it works?

Take a look at the example spec, (*4)

First use in 3 steps

  1. Add to your project, (*5)

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

    /*  /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, (*7)

    /*  /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

  • Should you need to customize .env variables for the test suite, you have 2 options:, (*8)

    • In the .env.kahlan file for persistent variables
    • At runtime:, (*9)

      /path/to/app$ vendor/bin/kahlan -env=DB_CONNECTION=sqlite,MAIL_DRIVER=log
      
  • In your specs you can use all the kahlan features, as well as Laravel testing sugar:, (*10)

    • helpers: app(), event() etc
    • Application methods $this->app->method() or $this->laravel->method()
    • Laravel TestCase features, eg. $this->laravel->get('/')->assertResponseOk()
    • Application instance as either of: $this->app === $this->laravel->app === app()
  • For tests that don't require Laravel there's --no-laravel cli option, since booting up the application for each test has huge impact on performance:, (*11)

    /path/to/app$ vendor/bin/kahlan --spec=spec/unit --no-laravel
    

    Alternatively you can provide NO_LARAVEL=true in .env/.env.kahlan file, then you would enable laravel only when necessary:, (*12)

    /path/to/app$ vendor/bin/kahlan --spec=spec/functional --no-laravel=false
    

Happy coding!

The Versions

07/02 2018

5.4.x-dev

5.4.9999999.9999999-dev

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

07/02 2018

v5.5.7

5.5.7.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

06/02 2018

v5.5.4

5.5.4.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

06/02 2018

v5.5.5

5.5.5.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

06/02 2018

v5.5.6

5.5.6.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

06/02 2018

v5.5.3

5.5.3.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

27/11 2017

v5.5.2

5.5.2.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

17/11 2017

v5.5.1

5.5.1.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

17/11 2017

v5.5

5.5.0.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

08/03 2017

v5.4.1

5.4.1.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

08/03 2017

v5.4

5.4.0.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

08/03 2017

5.3.x-dev

5.3.9999999.9999999-dev

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

08/03 2017

v5.3.2

5.3.2.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

02/12 2016

5.1.x-dev

5.1.9999999.9999999-dev

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

08/11 2016

v5.1.1

5.1.1.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

25/10 2016

v5.3.1

5.3.1.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

17/08 2016

v5.3

5.3.0.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

17/08 2016

5.2.x-dev

5.2.9999999.9999999-dev

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

17/08 2016

v5.2.3

5.2.3.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

17/08 2016

v5.2.2

5.2.2.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

17/08 2016

v5.2.1

5.2.1.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

17/08 2016

v5.2

5.2.0.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

17/08 2016

v5.1

5.1.0.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

17/08 2016

v0.2

0.2.0.0

Kahlan specs suite for testing Laravel applications

  Sources   Download

MIT

The Requires

 

laravel bdd tdd testing spec kahlan

16/08 2016

v0.1

0.1.0.0

Kahlan specs suite for Laravel application testing

  Sources   Download

MIT

The Requires