/** * @test */ function it_hashes_a_password() { Session::start(); \Illuminate\Support\Facades\Hash::shouldReceive('make')->once()->andReturn('foobar_hashed_password'); $response = $this->action('POST', 'HashingController@postIndex', ['password' => 'foobar_password', '_token' => csrf_token()]); $this->assertEquals('Your hash is foobar_hashed_password', $response->getContent()); }
public function testSetPasswordAttribute() { Hash::shouldReceive('make')->with('secret')->once()->andReturn('foo'); $this->user->password = '******'; $this->assertEquals('foo', $this->user->password); }