|
6 | 6 | */
|
7 | 7 | declare(strict_types=1);
|
8 | 8 |
|
9 |
| -namespace Ibexa\Tests\integration\Core\FieldType\Url\UrlStorage\Gateway; |
| 9 | +namespace Ibexa\Tests\Integration\Core\FieldType\Url\UrlStorage\Gateway; |
10 | 10 |
|
11 |
| -use eZ\Publish\Core\FieldType\Tests\Integration\Url\UrlStorage\UrlStorageGatewayTest; |
| 11 | +use eZ\Publish\Core\FieldType\Tests\Integration\BaseCoreFieldTypeIntegrationTest; |
12 | 12 | use eZ\Publish\Core\FieldType\Url\UrlStorage\Gateway as UrlStorageGateway;
|
13 | 13 | use eZ\Publish\Core\FieldType\Url\UrlStorage\Gateway\DoctrineStorage;
|
14 | 14 |
|
15 |
| -final class UrlDoctrineStorageGatewayTest extends UrlStorageGatewayTest |
| 15 | +/** |
| 16 | + * @covers \eZ\Publish\Core\FieldType\Url\UrlStorage\Gateway\DoctrineStorage |
| 17 | + */ |
| 18 | +final class UrlDoctrineStorageGatewayTest extends BaseCoreFieldTypeIntegrationTest |
16 | 19 | {
|
| 20 | + public function testGetUrlsFromUrlLink(): void |
| 21 | + { |
| 22 | + $gateway = $this->getGateway(); |
| 23 | + |
| 24 | + $urlIds = []; |
| 25 | + $urlIds[] = $gateway->insertUrl('https://ibexa.co/example1'); |
| 26 | + $urlIds[] = $gateway->insertUrl('https://ibexa.co/example2'); |
| 27 | + $urlIds[] = $gateway->insertUrl('https://ibexa.co/example3'); |
| 28 | + |
| 29 | + $gateway->linkUrl($urlIds[0], 10, 1); |
| 30 | + $gateway->linkUrl($urlIds[1], 10, 1); |
| 31 | + $gateway->linkUrl($urlIds[1], 12, 2); |
| 32 | + $gateway->linkUrl($urlIds[2], 14, 1); |
| 33 | + |
| 34 | + self::assertEquals(['https://ibexa.co/example1' => true, 'https://ibexa.co/example2' => true], $gateway->getUrlsFromUrlLink(10, 1), 'Did not get expected urlS for field 10'); |
| 35 | + self::assertEquals(['https://ibexa.co/example2' => true], $gateway->getUrlsFromUrlLink(12, 2), 'Did not get expected url for field 12'); |
| 36 | + self::assertEquals(['https://ibexa.co/example3' => true], $gateway->getUrlsFromUrlLink(14, 1), 'Did not get expected url for field 14'); |
| 37 | + self::assertEquals([], $gateway->getUrlsFromUrlLink(15, 1), 'Expected no urls for field 15'); |
| 38 | + } |
| 39 | + |
17 | 40 | protected function getGateway(): UrlStorageGateway
|
18 | 41 | {
|
19 | 42 | return new DoctrineStorage($this->getDatabaseConnection());
|
|
0 commit comments