hash.test.php 638 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. class HashTest extends PHPUnit_Framework_TestCase {
  3. /**
  4. * Test the Hash::make method.
  5. *
  6. * @group laravel
  7. */
  8. public function testHashProducesValidBcryptHash()
  9. {
  10. $this->assertTrue(strlen(Hash::make('taylor')) == 60);
  11. }
  12. /**
  13. * Test the Hash::check method.
  14. *
  15. * @group laravel
  16. */
  17. public function testHashCheckFailsWhenNotMatching()
  18. {
  19. $hash = Hash::make('taylor');
  20. $this->assertFalse(Hash::check('foo', $hash));
  21. }
  22. /**
  23. * Test the Hash::check method.
  24. *
  25. * @group laravel
  26. */
  27. public function testHashCheckPassesWhenMatches()
  28. {
  29. $this->assertTrue(Hash::check('taylor', Hash::make('taylor')));
  30. }
  31. }