Skip to content

Commit 15d3bf8

Browse files
committed
fix some risky tests
1 parent 5d4460c commit 15d3bf8

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

Tests/Encoder/BCryptPasswordEncoderTest.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,20 @@ public function testCostAboveRange()
3939
new BCryptPasswordEncoder(32);
4040
}
4141

42-
public function testCostInRange()
42+
/**
43+
* @dataProvider validRangeData
44+
*/
45+
public function testCostInRange($cost)
46+
{
47+
$this->assertInstanceOf('Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder', new BCryptPasswordEncoder($cost));
48+
}
49+
50+
public function validRangeData()
4351
{
44-
for ($cost = 4; $cost <= 31; ++$cost) {
45-
new BCryptPasswordEncoder($cost);
46-
}
52+
$costs = range(4, 31);
53+
array_walk($costs, function (&$cost) { $cost = array($cost); });
54+
55+
return $costs;
4756
}
4857

4958
public function testResultLength()

Tests/LegacySecurityContextTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ public function testOldConstructorSignature()
8686
{
8787
$authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock();
8888
$accessDecisionManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface')->getMock();
89-
new SecurityContext($authenticationManager, $accessDecisionManager);
89+
90+
$this->assertInstanceOf('Symfony\Component\Security\Core\SecurityContext', new SecurityContext($authenticationManager, $accessDecisionManager));
9091
}
9192

9293
/**

0 commit comments

Comments
 (0)