|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * @copyright Copyright (C) Ibexa AS. All rights reserved. |
| 5 | + * @license For full copyright and license information view LICENSE file distributed with this source code. |
| 6 | + */ |
| 7 | +namespace eZ\Publish\Core\FieldType\Tests\Integration\Url\UrlStorage; |
| 8 | + |
| 9 | +use eZ\Publish\Core\FieldType\Tests\Integration\BaseCoreFieldTypeIntegrationTest; |
| 10 | +use eZ\Publish\Core\FieldType\Url\UrlStorage\Gateway; |
| 11 | + |
| 12 | +/** |
| 13 | + * Url Field Type external storage gateway tests. |
| 14 | + */ |
| 15 | +abstract class UrlStorageGatewayTest extends BaseCoreFieldTypeIntegrationTest |
| 16 | +{ |
| 17 | + abstract protected function getGateway(): Gateway; |
| 18 | + |
| 19 | + /** |
| 20 | + * @covers \eZ\Publish\Core\FieldType\Url\UrlStorage\Gateway\DoctrineStorage::getUrlsFromUrlLink |
| 21 | + */ |
| 22 | + public function testGetUrlsFromUrlLink() |
| 23 | + { |
| 24 | + self::assertEquals(true, false, "force failure"); |
| 25 | + $gateway = $this->getGateway(); |
| 26 | + |
| 27 | + $urlIds = []; |
| 28 | + $urlIds[] = $gateway->insertUrl('https://ibexa.co/example1'); |
| 29 | + $urlIds[] = $gateway->insertUrl('https://ibexa.co/example2'); |
| 30 | + $urlIds[] = $gateway->insertUrl('https://ibexa.co/example3'); |
| 31 | + |
| 32 | + $gateway->linkUrl($urlIds[0], 10, 1); |
| 33 | + $gateway->linkUrl($urlIds[1], 10, 1); |
| 34 | + $gateway->linkUrl($urlIds[1], 12, 2); |
| 35 | + $gateway->linkUrl($urlIds[2], 14, 1); |
| 36 | + |
| 37 | + self::assertEquals(['https://ibexa.co/example1' => true, 'https://ibexa.co/example2' => true], $gateway->getUrlsFromUrlLink(10, 1), 'Did not get expected urlS for field 10'); |
| 38 | + self::assertEquals(['https://ibexa.co/example2' => true], $gateway->getUrlsFromUrlLink(12, 2), 'Did not get expected url for field 12'); |
| 39 | + self::assertEquals(['https://ibexa.co/example3' => true], $gateway->getUrlsFromUrlLink(14, 1), 'Did not get expected url for field 14'); |
| 40 | + self::assertEquals([], $gateway->getUrlsFromUrlLink(15, 1), 'Expected no urls for field 15'); |
| 41 | + } |
| 42 | +} |
0 commit comments