@@ -45,19 +45,21 @@ public function testCostInRange()
45
45
}
46
46
}
47
47
48
+ /**
49
+ * @requires PHP 5.3.7
50
+ */
48
51
public function testResultLength ()
49
52
{
50
- $ this ->skipIfPhpVersionIsNotSupported ();
51
-
52
53
$ encoder = new BCryptPasswordEncoder (self ::VALID_COST );
53
54
$ result = $ encoder ->encodePassword (self ::PASSWORD , null );
54
55
$ this ->assertEquals (60 , strlen ($ result ));
55
56
}
56
57
58
+ /**
59
+ * @requires PHP 5.3.7
60
+ */
57
61
public function testValidation ()
58
62
{
59
- $ this ->skipIfPhpVersionIsNotSupported ();
60
-
61
63
$ encoder = new BCryptPasswordEncoder (self ::VALID_COST );
62
64
$ result = $ encoder ->encodePassword (self ::PASSWORD , null );
63
65
$ this ->assertTrue ($ encoder ->isPasswordValid ($ result , self ::PASSWORD , null ));
@@ -74,21 +76,15 @@ public function testEncodePasswordLength()
74
76
$ encoder ->encodePassword (str_repeat ('a ' , 73 ), 'salt ' );
75
77
}
76
78
79
+ /**
80
+ * @requires PHP 5.3.7
81
+ */
77
82
public function testCheckPasswordLength ()
78
83
{
79
- $ this ->skipIfPhpVersionIsNotSupported ();
80
-
81
84
$ encoder = new BCryptPasswordEncoder (self ::VALID_COST );
82
85
$ result = $ encoder ->encodePassword (str_repeat ('a ' , 72 ), null );
83
86
84
87
$ this ->assertFalse ($ encoder ->isPasswordValid ($ result , str_repeat ('a ' , 73 ), 'salt ' ));
85
88
$ this ->assertTrue ($ encoder ->isPasswordValid ($ result , str_repeat ('a ' , 72 ), 'salt ' ));
86
89
}
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
- }
94
90
}
0 commit comments