Code Duplication    Length = 24-24 lines in 3 locations

eZ/Publish/Core/Repository/Tests/Service/Mock/NameSchemaTest.php 3 locations

@@ 30-53 (lines=24) @@
27
     *
28
     * @covers \eZ\Publish\Core\Repository\Helper\NameSchemaService::resolveUrlAliasSchema
29
     */
30
    public function testResolveUrlAliasSchema()
31
    {
32
        $serviceMock = $this->getPartlyMockedNameSchemaService(array('resolve'));
33
34
        $content = $this->buildTestContentObject();
35
        $contentType = $this->buildTestContentType();
36
37
        $serviceMock->expects(
38
            $this->once()
39
        )->method(
40
            'resolve'
41
        )->with(
42
            '<urlalias_schema>',
43
            $this->equalTo($contentType),
44
            $this->equalTo($content->fields),
45
            $this->equalTo($content->versionInfo->languageCodes)
46
        )->will(
47
            $this->returnValue(42)
48
        );
49
50
        $result = $serviceMock->resolveUrlAliasSchema($content, $contentType);
51
52
        self::assertEquals(42, $result);
53
    }
54
55
    /**
56
     * Test eZ\Publish\Core\Repository\Helper\NameSchemaService method.
@@ 60-83 (lines=24) @@
57
     *
58
     * @covers \eZ\Publish\Core\Repository\Helper\NameSchemaService::resolveUrlAliasSchema
59
     */
60
    public function testResolveUrlAliasSchemaFallbackToNameSchema()
61
    {
62
        $serviceMock = $this->getPartlyMockedNameSchemaService(array('resolve'));
63
64
        $content = $this->buildTestContentObject();
65
        $contentType = $this->buildTestContentType('<name_schema>', '');
66
67
        $serviceMock->expects(
68
            $this->once()
69
        )->method(
70
            'resolve'
71
        )->with(
72
            '<name_schema>',
73
            $this->equalTo($contentType),
74
            $this->equalTo($content->fields),
75
            $this->equalTo($content->versionInfo->languageCodes)
76
        )->will(
77
            $this->returnValue(42)
78
        );
79
80
        $result = $serviceMock->resolveUrlAliasSchema($content, $contentType);
81
82
        self::assertEquals(42, $result);
83
    }
84
85
    /**
86
     * Test eZ\Publish\Core\Repository\Helper\NameSchemaService method.
@@ 90-113 (lines=24) @@
87
     *
88
     * @covers \eZ\Publish\Core\Repository\Helper\NameSchemaService::resolveNameSchema
89
     */
90
    public function testResolveNameSchema()
91
    {
92
        $serviceMock = $this->getPartlyMockedNameSchemaService(array('resolve'));
93
94
        $content = $this->buildTestContentObject();
95
        $contentType = $this->buildTestContentType();
96
97
        $serviceMock->expects(
98
            $this->once()
99
        )->method(
100
            'resolve'
101
        )->with(
102
            '<name_schema>',
103
            $this->equalTo($contentType),
104
            $this->equalTo($content->fields),
105
            $this->equalTo($content->versionInfo->languageCodes)
106
        )->will(
107
            $this->returnValue(42)
108
        );
109
110
        $result = $serviceMock->resolveNameSchema($content, array(), array(), $contentType);
111
112
        self::assertEquals(42, $result);
113
    }
114
115
    /**
116
     * Test eZ\Publish\Core\Repository\Helper\NameSchemaService method.