Code Duplication    Length = 9-59 lines in 3 locations

eZ/Publish/Core/FieldType/Tests/RichText/Converter/LinkTest.php 2 locations

@@ 146-204 (lines=59) @@
143
    /**
144
     * @return array
145
     */
146
    public function providerLocationLink()
147
    {
148
        return [
149
            [
150
                '<?xml version="1.0" encoding="UTF-8"?>
151
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" version="5.0-variant ezpublish-1.0">
152
  <title>Link example</title>
153
  <para>
154
    <link xlink:href="ezlocation://106">Content name</link>
155
  </para>
156
</section>',
157
                '<?xml version="1.0" encoding="UTF-8"?>
158
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" version="5.0-variant ezpublish-1.0">
159
  <title>Link example</title>
160
  <para>
161
    <link xlink:href="test">Content name</link>
162
  </para>
163
</section>',
164
                106,
165
                'test',
166
            ],
167
            [
168
                '<?xml version="1.0" encoding="UTF-8"?>
169
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" version="5.0-variant ezpublish-1.0">
170
  <title>Link example</title>
171
  <para>
172
    <link xlink:href="ezlocation://106#anchor">Content name</link>
173
  </para>
174
</section>',
175
                '<?xml version="1.0" encoding="UTF-8"?>
176
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" version="5.0-variant ezpublish-1.0">
177
  <title>Link example</title>
178
  <para>
179
    <link xlink:href="test#anchor">Content name</link>
180
  </para>
181
</section>',
182
                106,
183
                'test',
184
            ],
185
            [
186
                '<?xml version="1.0" encoding="UTF-8"?>
187
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" version="5.0-variant ezpublish-1.0">
188
  <title>Link example</title>
189
  <ezembed>
190
    <ezlink xlink:href="ezlocation://106#anchor"/>
191
  </ezembed>
192
</section>',
193
                '<?xml version="1.0" encoding="UTF-8"?>
194
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" version="5.0-variant ezpublish-1.0">
195
  <title>Link example</title>
196
  <ezembed>
197
    <ezlink xlink:href="ezlocation://106#anchor" href_resolved="test#anchor"/>
198
  </ezembed>
199
</section>',
200
                106,
201
                'test',
202
            ],
203
        ];
204
    }
205
206
    /**
207
     * Test conversion of ezlocation://<id> links.
@@ 349-407 (lines=59) @@
346
    /**
347
     * @return array
348
     */
349
    public function providerContentLink()
350
    {
351
        return [
352
            [
353
                '<?xml version="1.0" encoding="UTF-8"?>
354
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" version="5.0-variant ezpublish-1.0">
355
  <title>Link example</title>
356
  <para>
357
    <link xlink:href="ezcontent://104">Content name</link>
358
  </para>
359
</section>',
360
                '<?xml version="1.0" encoding="UTF-8"?>
361
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" version="5.0-variant ezpublish-1.0">
362
  <title>Link example</title>
363
  <para>
364
    <link xlink:href="test">Content name</link>
365
  </para>
366
</section>',
367
                104,
368
                'test',
369
            ],
370
            [
371
                '<?xml version="1.0" encoding="UTF-8"?>
372
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" version="5.0-variant ezpublish-1.0">
373
  <title>Link example</title>
374
  <para>
375
    <link xlink:href="ezcontent://104#anchor">Content name</link>
376
  </para>
377
</section>',
378
                '<?xml version="1.0" encoding="UTF-8"?>
379
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" version="5.0-variant ezpublish-1.0">
380
  <title>Link example</title>
381
  <para>
382
    <link xlink:href="test#anchor">Content name</link>
383
  </para>
384
</section>',
385
                104,
386
                'test',
387
            ],
388
            [
389
                '<?xml version="1.0" encoding="UTF-8"?>
390
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" version="5.0-variant ezpublish-1.0">
391
  <title>Link example</title>
392
  <ezembed>
393
    <ezlink xlink:href="ezcontent://104#anchor"/>
394
  </ezembed>
395
</section>',
396
                '<?xml version="1.0" encoding="UTF-8"?>
397
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" version="5.0-variant ezpublish-1.0">
398
  <title>Link example</title>
399
  <ezembed>
400
    <ezlink xlink:href="ezcontent://104#anchor" href_resolved="test#anchor"/>
401
  </ezembed>
402
</section>',
403
                104,
404
                'test',
405
            ],
406
        ];
407
    }
408
409
    /**
410
     * Test conversion of ezcontent://<id> links.

eZ/Publish/API/Repository/Tests/URLServiceTest.php 1 location

@@ 868-876 (lines=9) @@
865
        $this->assertUsagesSearchResultItems($usagesSearchResults, $expectedContentInfos);
866
    }
867
868
    public function dataProviderForFindUsages()
869
    {
870
        return [
871
            // findUsages($url, 0, -1)
872
            [23, 0, -1, [54], 1],
873
            // findUsages($url, 0, $limit)
874
            [23, 0, 1, [54], 1],
875
        ];
876
    }
877
878
    /**
879
     * Test for URLService::testFindUsages() method.