Skip to content

Instantly share code, notes, and snippets.

@kgust
Created April 22, 2014 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kgust/11187011 to your computer and use it in GitHub Desktop.
Save kgust/11187011 to your computer and use it in GitHub Desktop.
<?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());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment