Completed
Push — migrate-files-no-interaction ( 025687...608925 )
by
unknown
46:43 queued 18:48
created

LazyRepositoryFactoryTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A testBuildRepository() 0 12 1
1
<?php
2
3
/**
4
 * File containing the LazyRepositoryFactoryTest class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Bundle\EzPublishCoreBundle\Tests\ApiLoader;
10
11
use eZ\Bundle\EzPublishCoreBundle\ApiLoader\LazyRepositoryFactory;
12
use PHPUnit\Framework\TestCase;
13
14
class LazyRepositoryFactoryTest extends TestCase
15
{
16
    public function testBuildRepository()
17
    {
18
        $repositoryMock = $this->createMock('eZ\\Publish\\API\\Repository\\Repository');
19
        $factory = new LazyRepositoryFactory($repositoryMock);
0 ignored issues
show
Deprecated Code introduced by
The class eZ\Bundle\EzPublishCoreB...r\LazyRepositoryFactory has been deprecated with message: This factory is not needed any more as ProxyManager is now used for lazy loading. Use ezpublish.api.repository instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
20
        $lazyRepository = $factory->buildRepository();
21
        $this->assertInternalType('callable', $lazyRepository);
22
23
        // Calling several times to ensure container is called only once.
24
        $this->assertSame($repositoryMock, $lazyRepository());
25
        $this->assertSame($repositoryMock, $lazyRepository());
26
        $this->assertSame($repositoryMock, $lazyRepository());
27
    }
28
}
29