Code Duplication    Length = 12-12 lines in 3 locations

eZ/Publish/Core/REST/Server/Tests/Input/Parser/Criterion/UserMetadataTest.php 3 locations

@@ 76-87 (lines=12) @@
73
     * @expectedException \eZ\Publish\Core\REST\Common\Exceptions\Parser
74
     * @expectedExceptionMessage Invalid <Target> format
75
     */
76
    public function testParseExceptionOnInvalidTargetFormat()
77
    {
78
        $inputArray = [
79
            'UserMetadataCriterion' => [
80
                'foo' => 'Mock around the clock',
81
                'Value' => 42,
82
            ]
83
        ];
84
85
        $dataKeyValueObjectClass = $this->getParser();
86
        $dataKeyValueObjectClass->parse($inputArray, $this->getParsingDispatcherMock());
87
    }
88
89
    /**
90
     * Test UserMetadata parser throwing exception on invalid value format.
@@ 95-106 (lines=12) @@
92
     * @expectedException \eZ\Publish\Core\REST\Common\Exceptions\Parser
93
     * @expectedExceptionMessage Invalid <Value> format
94
     */
95
    public function testParseExceptionOnInvalidValueFormat()
96
    {
97
        $inputArray = [
98
            'UserMetadataCriterion' => [
99
                'Target' => 'Moxette',
100
                'foo' => 42,
101
            ]
102
        ];
103
104
        $dataKeyValueObjectClass = $this->getParser();
105
        $dataKeyValueObjectClass->parse($inputArray, $this->getParsingDispatcherMock());
106
    }
107
108
    /**
109
     * Test UserMetadata parser throwing exception on wrong type of value format.
@@ 114-125 (lines=12) @@
111
     * @expectedException \eZ\Publish\Core\REST\Common\Exceptions\Parser
112
     * @expectedExceptionMessage Invalid <Value> format
113
     */
114
    public function testParseExceptionOnWrongValueType()
115
    {
116
        $inputArray = [
117
            'UserMetadataCriterion' => [
118
                'Target' => 'Moxette',
119
                'Value' => new \stdClass(),
120
            ]
121
        ];
122
123
        $dataKeyValueObjectClass = $this->getParser();
124
        $dataKeyValueObjectClass->parse($inputArray, $this->getParsingDispatcherMock());
125
    }
126
127
    /**
128
     * Returns the UserMetadata criterion parser.