Browse Source

Changing a test to use annotations vs asserts

Florian Krämer 8 years ago
parent
commit
3f88924123
1 changed files with 3 additions and 6 deletions
  1. 3 6
      tests/TestCase/Utility/SecurityTest.php

+ 3 - 6
tests/TestCase/Utility/SecurityTest.php

@@ -73,16 +73,13 @@ class SecurityTest extends TestCase
     /**
      * testInvalidHashTypeException
      *
+     * @expectedException \RuntimeException
+     * @expectedExceptionMessageRegExp /The hash type `doesnotexist` was not found. Available algorithms are: \w+/
      * @return void
      */
     public function testInvalidHashTypeException()
     {
-        try {
-            Security::hash('test', 'doesnotexist', false);
-            $this->fail('Expected \RuntimeException');
-        } catch (RuntimeException $e) {
-            $this->assertTextContains('The hash type `doesnotexist` was not found. Available algorithms are:', $e->getMessage());
-        }
+        Security::hash('test', 'doesnotexist', false);
     }
 
     /**