@@ -45,19 +45,21 @@ public function testCostInRange()
4545 }
4646 }
4747
48+ /**
49+ * @requires PHP 5.3.7
50+ */
4851 public function testResultLength ()
4952 {
50- $ this ->skipIfPhpVersionIsNotSupported ();
51-
5253 $ encoder = new BCryptPasswordEncoder (self ::VALID_COST );
5354 $ result = $ encoder ->encodePassword (self ::PASSWORD , null );
5455 $ this ->assertEquals (60 , strlen ($ result ));
5556 }
5657
58+ /**
59+ * @requires PHP 5.3.7
60+ */
5761 public function testValidation ()
5862 {
59- $ this ->skipIfPhpVersionIsNotSupported ();
60-
6163 $ encoder = new BCryptPasswordEncoder (self ::VALID_COST );
6264 $ result = $ encoder ->encodePassword (self ::PASSWORD , null );
6365 $ this ->assertTrue ($ encoder ->isPasswordValid ($ result , self ::PASSWORD , null ));
@@ -74,21 +76,15 @@ public function testEncodePasswordLength()
7476 $ encoder ->encodePassword (str_repeat ('a ' , 73 ), 'salt ' );
7577 }
7678
79+ /**
80+ * @requires PHP 5.3.7
81+ */
7782 public function testCheckPasswordLength ()
7883 {
79- $ this ->skipIfPhpVersionIsNotSupported ();
80-
8184 $ encoder = new BCryptPasswordEncoder (self ::VALID_COST );
8285 $ result = $ encoder ->encodePassword (str_repeat ('a ' , 72 ), null );
8386
8487 $ this ->assertFalse ($ encoder ->isPasswordValid ($ result , str_repeat ('a ' , 73 ), 'salt ' ));
8588 $ this ->assertTrue ($ encoder ->isPasswordValid ($ result , str_repeat ('a ' , 72 ), 'salt ' ));
8689 }
87-
88- private function skipIfPhpVersionIsNotSupported ()
89- {
90- if (PHP_VERSION_ID < 50307 && !\PasswordCompat \binary \check ()) {
91- $ this ->markTestSkipped ('Skipping test as this PHP version is not compatible with the ircmaxell/password-compat library. ' );
92- }
93- }
9490}
0 commit comments