Code Duplication    Length = 26-29 lines in 2 locations

eZ/Publish/Core/REST/Server/Tests/Output/PathExpansion/ValueLoaders/ControllerUriValueLoaderTest.php 2 locations

@@ 40-68 (lines=29) @@
37
    /**
38
     * Covers the normal behaviour of the load method.
39
     */
40
    public function testLoad()
41
    {
42
        $controllerArray = ['_controller' => 'some:controller', 'id' => 1];
43
44
        $valueObject = new \stdClass();
45
46
        $this->routerMock
47
            ->expects($this->once())
48
            ->method('match')
49
            ->with('/api/ezp/v2/resource/1')
50
            ->will($this->returnValue($controllerArray));
51
52
        $this->controllerResolverMock
53
            ->expects($this->once())
54
            ->method('getController')
55
            ->will($this->returnValue(
56
                function () use ($valueObject) { return $valueObject; }
57
            ));
58
59
        $this->controllerResolverMock
60
            ->expects($this->once())
61
            ->method('getArguments')
62
            ->will($this->returnValue(['id' => 1]));
63
64
        self::assertSame(
65
            $valueObject,
66
            $this->loader->load('/api/ezp/v2/resource/1')
67
        );
68
    }
69
70
    /**
71
     * @expectedException \UnexpectedValueException
@@ 74-99 (lines=26) @@
71
     * @expectedException \UnexpectedValueException
72
     * @expectedExceptionMessage Expected the controller to return a Value object, got a Response instead
73
     */
74
    public function testLoadReturnsResponse()
75
    {
76
        $controllerArray = ['_controller' => 'some:controller', 'id' => 1];
77
78
        $valueObject = new Response();
79
80
        $this->routerMock
81
            ->expects($this->once())
82
            ->method('match')
83
            ->with('/api/ezp/v2/resource/1')
84
            ->will($this->returnValue($controllerArray));
85
86
        $this->controllerResolverMock
87
            ->expects($this->once())
88
            ->method('getController')
89
            ->will($this->returnValue(
90
                function () use ($valueObject) { return $valueObject; }
91
            ));
92
93
        $this->controllerResolverMock
94
            ->expects($this->once())
95
            ->method('getArguments')
96
            ->will($this->returnValue(['id' => 1]));
97
98
        $this->loader->load('/api/ezp/v2/resource/1');
99
    }
100
}
101