| @@ 17-61 (lines=45) @@ | ||
| 14 | ||
| 15 | class DocbookTest extends TestCase |
|
| 16 | { |
|
| 17 | public function providerForTestValidate() |
|
| 18 | { |
|
| 19 | return array( |
|
| 20 | array( |
|
| 21 | '<?xml version="1.0" encoding="UTF-8"?> |
|
| 22 | <section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" version="5.0-variant ezpublish-1.0"> |
|
| 23 | <para> |
|
| 24 | <link xlink:href="ezurl://72">Hello <link xlink:href="ezurl://27">goodbye</link></link> |
|
| 25 | </para> |
|
| 26 | </section> |
|
| 27 | ', |
|
| 28 | array( |
|
| 29 | 'link must not occur in the descendants of link', |
|
| 30 | ), |
|
| 31 | ), |
|
| 32 | array( |
|
| 33 | '<?xml version="1.0" encoding="UTF-8"?> |
|
| 34 | <section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" version="5.0-variant ezpublish-1.0"> |
|
| 35 | <para>Some <link xlink:href="ezcontent://601">linked <ezembedinline xlink:href="ezcontent://601"> |
|
| 36 | <ezlink xlink:href="ezcontent://106"/> |
|
| 37 | </ezembedinline> linked</link> embeds.</para> |
|
| 38 | </section> |
|
| 39 | ', |
|
| 40 | array( |
|
| 41 | 'ezlink must not occur in the descendants of link', |
|
| 42 | ), |
|
| 43 | ), |
|
| 44 | array( |
|
| 45 | '<?xml version="1.0" encoding="UTF-8"?> |
|
| 46 | <section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" version="5.0-variant ezpublish-1.0"> |
|
| 47 | <para ezxhtml:class="listening loud indie rock">Nada Surf - Happy Kid</para> |
|
| 48 | </section> |
|
| 49 | ', |
|
| 50 | array(), |
|
| 51 | ), |
|
| 52 | array( |
|
| 53 | '<?xml version="1.0" encoding="UTF-8"?> |
|
| 54 | <section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" version="5.0-variant ezpublish-1.0"> |
|
| 55 | <para ezxhtml:class="">Nada Surf - Happy Kid</para> |
|
| 56 | </section> |
|
| 57 | ', |
|
| 58 | array(), |
|
| 59 | ), |
|
| 60 | ); |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * @dataProvider providerForTestValidate |
|
| @@ 168-179 (lines=12) @@ | ||
| 165 | $this->assertSame(array(), $validator->getMessage()); |
|
| 166 | } |
|
| 167 | ||
| 168 | public function providerForValidateOK() |
|
| 169 | { |
|
| 170 | return array( |
|
| 171 | array(10), |
|
| 172 | array(11), |
|
| 173 | array(12), |
|
| 174 | array(12.5), |
|
| 175 | array(13), |
|
| 176 | array(14), |
|
| 177 | array(15), |
|
| 178 | ); |
|
| 179 | } |
|
| 180 | ||
| 181 | /** |
|
| 182 | * Tests validating a wrong value. |
|
| @@ 21-61 (lines=41) @@ | ||
| 18 | ||
| 19 | class RichTextStorageTest extends TestCase |
|
| 20 | { |
|
| 21 | public function providerForTestGetFieldData() |
|
| 22 | { |
|
| 23 | return array( |
|
| 24 | array( |
|
| 25 | '<?xml version="1.0" encoding="UTF-8"?> |
|
| 26 | <section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" version="5.0-variant ezpublish-1.0"> |
|
| 27 | <para> |
|
| 28 | <link xlink:href="ezurl://123#fragment1">Existing external link</link> |
|
| 29 | </para> |
|
| 30 | <para> |
|
| 31 | <link xlink:href="ezurl://456#fragment2">Non-existing external link</link> |
|
| 32 | </para> |
|
| 33 | </section>', |
|
| 34 | '<?xml version="1.0" encoding="UTF-8"?> |
|
| 35 | <section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" version="5.0-variant ezpublish-1.0"> |
|
| 36 | <para> |
|
| 37 | <link xlink:href="http://www.ez.no#fragment1">Existing external link</link> |
|
| 38 | </para> |
|
| 39 | <para> |
|
| 40 | <link xlink:href="#">Non-existing external link</link> |
|
| 41 | </para> |
|
| 42 | </section> |
|
| 43 | ', |
|
| 44 | array(123, 456), |
|
| 45 | array(123 => 'http://www.ez.no'), |
|
| 46 | ), |
|
| 47 | array( |
|
| 48 | '<?xml version="1.0" encoding="UTF-8"?> |
|
| 49 | <section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" version="5.0-variant ezpublish-1.0"> |
|
| 50 | <para>Oh links, where art thou?</para> |
|
| 51 | </section>', |
|
| 52 | '<?xml version="1.0" encoding="UTF-8"?> |
|
| 53 | <section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" version="5.0-variant ezpublish-1.0"> |
|
| 54 | <para>Oh links, where art thou?</para> |
|
| 55 | </section> |
|
| 56 | ', |
|
| 57 | array(), |
|
| 58 | array(), |
|
| 59 | ), |
|
| 60 | ); |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * @dataProvider providerForTestGetFieldData |
|
| @@ 33-45 (lines=13) @@ | ||
| 30 | ]; |
|
| 31 | } |
|
| 32 | ||
| 33 | public static function restRequestUrisProvider() |
|
| 34 | { |
|
| 35 | return [ |
|
| 36 | ['/api/ezp/v2/true'], |
|
| 37 | ['/api/bundle-name/v2/true'], |
|
| 38 | ['/api/MyBundle12/v2/true'], |
|
| 39 | ['/api/ThisIs_Bundle123/v2/true'], |
|
| 40 | ['/api/my-bundle/v1/true'], |
|
| 41 | ['/api/my-bundle/v2/true'], |
|
| 42 | ['/api/my-bundle/v2.7/true'], |
|
| 43 | ['/api/my-bundle/v122.73/true'], |
|
| 44 | ]; |
|
| 45 | } |
|
| 46 | ||
| 47 | public static function nonRestRequestsUrisProvider() |
|
| 48 | { |
|
| @@ 47-59 (lines=13) @@ | ||
| 44 | ]; |
|
| 45 | } |
|
| 46 | ||
| 47 | public static function nonRestRequestsUrisProvider() |
|
| 48 | { |
|
| 49 | return [ |
|
| 50 | ['/ap/ezp/v2/false'], |
|
| 51 | ['/api/bundle name/v2/false'], |
|
| 52 | ['/api/My/Bundle/v2/false'], |
|
| 53 | ['/api//v2/false'], |
|
| 54 | ['/api/my-bundle/v/false'], |
|
| 55 | ['/api/my-bundle/v2-2/false'], |
|
| 56 | ['/api/my-bundle/v2 7/false'], |
|
| 57 | ['/api/my-bundle/v/7/false'], |
|
| 58 | ]; |
|
| 59 | } |
|
| 60 | ||
| 61 | public function testOnKernelRequestNotMasterRequest() |
|
| 62 | { |
|
| @@ 309-319 (lines=11) @@ | ||
| 306 | * |
|
| 307 | * @return array |
|
| 308 | */ |
|
| 309 | public function providerGetContextBySimplifiedRequest() |
|
| 310 | { |
|
| 311 | return [ |
|
| 312 | ['/foo/bar'], |
|
| 313 | ['http://ezpublish.dev/foo/bar'], |
|
| 314 | ['http://ezpublish.dev:8080/foo/bar'], |
|
| 315 | ['https://ezpublish.dev/secured'], |
|
| 316 | ['https://ezpublish.dev:445/secured'], |
|
| 317 | ['http://ezpublish.dev:8080/foo/root_folder/bar/baz'], |
|
| 318 | ]; |
|
| 319 | } |
|
| 320 | ||
| 321 | private function getExpectedRequestContext($uri) |
|
| 322 | { |
|