Completed
Push — master ( 739ea2...dd79ae )
by Asmir
13s
created

Tests/Cache/CacheWarmerTest.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * Copyright 2011 Johannes M. Schmitt <[email protected]>
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 * http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace JMS\SerializerBundle\Tests\Cache;
20
21
use JMS\SerializerBundle\Cache\CacheWarmer;
22
use JMS\SerializerBundle\Tests\Cache\Files\Bar\BarBar;
23
use Metadata\MetadataFactoryInterface;
24
use PHPUnit\Framework\TestCase;
25
26
class CacheWarmerTest extends TestCase
27
{
28
    private $metadataFactory;
29
30
    public function setUp()
31
    {
32
        $this->metadataFactory = $this->getMockBuilder(MetadataFactoryInterface::class)
33
            ->disableOriginalConstructor()
34
            ->getMock();
35
    }
36
37 View Code Duplication
    public function testWarmUpRecursive()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
38
    {
39
40
        $this->metadataFactory->expects($this->exactly(3))
41
            ->method('getMetadataForClass');
42
43
        $warmer = new CacheWarmer([__DIR__ . "/Files"], $this->metadataFactory);
44
        $warmer->warmUp("foo");
45
    }
46
47 View Code Duplication
    public function testWarmUpRecursiveWithInclusion()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
48
    {
49
        $this->metadataFactory->expects($this->exactly(1))
50
            ->method('getMetadataForClass')->with(BarBar::class);
51
52
        $warmer = new CacheWarmer([__DIR__ . "/Files/Ba*"], $this->metadataFactory);
53
        $warmer->warmUp("foo");
54
    }
55
56 View Code Duplication
    public function testWarmUpRecursiveWithExclusion()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
57
    {
58
        $this->metadataFactory->expects($this->exactly(2))
59
            ->method('getMetadataForClass');
60
61
        $warmer = new CacheWarmer([__DIR__ . "/Files"], $this->metadataFactory, ["Bar"]);
62
        $warmer->warmUp("foo");
63
    }
64
}
65
66