| @@ 67-80 (lines=14) @@ | ||
| 64 | * |
|
| 65 | * @return UserInterface |
|
| 66 | */ |
|
| 67 | private function mockUserInterface(array $methodReturns) |
|
| 68 | { |
|
| 69 | /** @var UserInterface|\PHPUnit_Framework_MockObject_MockObject $user */ |
|
| 70 | $user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); |
|
| 71 | ||
| 72 | foreach ($methodReturns as $method => $return) { |
|
| 73 | $user->expects(TestCase::any()) |
|
| 74 | ->method($method) |
|
| 75 | ->will(TestCase::returnValue($return)) |
|
| 76 | ; |
|
| 77 | } |
|
| 78 | ||
| 79 | return $user; |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * @param array $methodReturns |
|
| @@ 87-100 (lines=14) @@ | ||
| 84 | * |
|
| 85 | * @return UserInterface|LdapUserInterface |
|
| 86 | */ |
|
| 87 | private function mockLdapUserInterface(array $methodReturns) |
|
| 88 | { |
|
| 89 | /** @var UserInterface|LdapUserInterface|\PHPUnit_Framework_MockObject_MockObject $user */ |
|
| 90 | $user = $this->getMock('DoL\LdapBundle\Tests\TestUser'); |
|
| 91 | ||
| 92 | foreach ($methodReturns as $method => $return) { |
|
| 93 | $user->expects(TestCase::any()) |
|
| 94 | ->method($method) |
|
| 95 | ->will(TestCase::returnValue($return)) |
|
| 96 | ; |
|
| 97 | } |
|
| 98 | ||
| 99 | return $user; |
|
| 100 | } |
|
| 101 | } |
|
| 102 | ||