Code Duplication    Length = 16-16 lines in 5 locations

eZ/Publish/Core/IO/Tests/IOMetadataHandler/LegacyDFSClusterTest.php 5 locations

@@ 92-107 (lines=16) @@
89
        $this->handler->create($spiCreateStruct);
90
    }
91
92
    public function testDelete()
93
    {
94
        $statement = $this->createDbalStatementMock();
95
        $statement
96
            ->expects($this->once())
97
            ->method('rowCount')
98
            ->will($this->returnValue(1));
99
100
        $this->dbalMock
101
            ->expects($this->once())
102
            ->method('prepare')
103
            ->with($this->anything())
104
            ->will($this->returnValue($statement));
105
106
        $this->handler->delete('prefix/my/file.png');
107
    }
108
109
    /**
110
     * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException
@@ 112-127 (lines=16) @@
109
    /**
110
     * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException
111
     */
112
    public function testDeleteNotFound()
113
    {
114
        $statement = $this->createDbalStatementMock();
115
        $statement
116
            ->expects($this->once())
117
            ->method('rowCount')
118
            ->will($this->returnValue(0));
119
120
        $this->dbalMock
121
            ->expects($this->once())
122
            ->method('prepare')
123
            ->with($this->anything())
124
            ->will($this->returnValue($statement));
125
126
        $this->handler->delete('prefix/my/file.png');
127
    }
128
129
    public function testLoad()
130
    {
@@ 163-178 (lines=16) @@
160
    /**
161
     * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException
162
     */
163
    public function testLoadNotFound()
164
    {
165
        $statement = $this->createDbalStatementMock();
166
        $statement
167
            ->expects($this->once())
168
            ->method('rowCount')
169
            ->will($this->returnValue(0));
170
171
        $this->dbalMock
172
            ->expects($this->once())
173
            ->method('prepare')
174
            ->with($this->anything())
175
            ->will($this->returnValue($statement));
176
177
        $this->handler->load('prefix/my/file.png');
178
    }
179
180
    public function testExists()
181
    {
@@ 180-195 (lines=16) @@
177
        $this->handler->load('prefix/my/file.png');
178
    }
179
180
    public function testExists()
181
    {
182
        $statement = $this->createDbalStatementMock();
183
        $statement
184
            ->expects($this->once())
185
            ->method('rowCount')
186
            ->will($this->returnValue(1));
187
188
        $this->dbalMock
189
            ->expects($this->once())
190
            ->method('prepare')
191
            ->with($this->anything())
192
            ->will($this->returnValue($statement));
193
194
        self::assertTrue($this->handler->exists('prefix/my/file.png'));
195
    }
196
197
    public function testExistsNot()
198
    {
@@ 197-212 (lines=16) @@
194
        self::assertTrue($this->handler->exists('prefix/my/file.png'));
195
    }
196
197
    public function testExistsNot()
198
    {
199
        $statement = $this->createDbalStatementMock();
200
        $statement
201
            ->expects($this->once())
202
            ->method('rowCount')
203
            ->will($this->returnValue(0));
204
205
        $this->dbalMock
206
            ->expects($this->once())
207
            ->method('prepare')
208
            ->with($this->anything())
209
            ->will($this->returnValue($statement));
210
211
        self::assertFalse($this->handler->exists('prefix/my/file.png'));
212
    }
213
214
    public function testDeletedirectory()
215
    {