UserProfileFactoryTest.php 1.35 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php

namespace UnicaenAppTest\View\Helper;

use UnicaenAppTest\View\Helper\BaseServiceFactoryTest;

/**
 * Description of UserProfileFactoryTest
 *
 * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
 */
class UserProfileFactoryTest extends BaseServiceFactoryTest
{
    protected $factoryClass = 'UnicaenAuth\View\Helper\UserProfileFactory';
    protected $serviceClass = 'UnicaenAuth\View\Helper\UserProfile';
16

17
18
    public function testCanCreateService()
    {
Bertrand Gauthier's avatar
Bertrand Gauthier committed
19
        $authService      = $this->createMock('Laminas\Authentication\AuthenticationService');
20
        $authorize        = $this->createMock('BjyAuthorize\Service\Authorize'/*, ['getIdentityProvider'], [], '', false*/);
21
        $identityProvider = $this->getMockForAbstractClass('BjyAuthorize\Provider\Identity\ProviderInterface', []);
22
23
24
25

        $authorize->expects($this->once())
                ->method('getIdentityProvider')
                ->will($this->returnValue($identityProvider));
26

27
28
        $this->serviceManager->expects($this->exactly(2))
                ->method('get')
29
30
31
32
                ->will($this->returnValueMap([
                    ['zfcuser_auth_service', $authService],
                    ['BjyAuthorize\Service\Authorize', $authorize]]));

33
        $service = $this->factory->__invoke($this->serviceManager, '');
34

35
36
37
        $this->assertInstanceOf($this->serviceClass, $service);
    }
}