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

LazyRepositoryFactoryTest::testBuildRepository()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
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