kgust
4/22/2014 - 5:08 PM

From https://laracasts.com/lessons/the-unit-testing-laravel-facades-conundrum

<?php

require 'vendor/phpunit/phpunit/src/Framework/Assert/Functions.php';

class ExampleTest exends TestCase
{
  
    /** @test */
    function it_hashes_a_provided_password()
    {
        Hash::shouldReceive('make')->once()->andReturn('foobar_hashed_password');
        $response = $this->action('POST', 'HashingController@postIndex', ['password' => 'foobar_password']);
        
        // NOTE: Because of the require above, you can use asserts like functions.
        assertEquals('Your hashed password is foobar_hashed_password.', $response->getContent());
    }
}