-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IBX-1784: Added getDefaultLanguageCode method to API/Repository/Value…
…s/Content/Content (#279) * Added getDefaultLanguageCode method to API/Repository/Values/Content/Content * Added test cases for Content's DefaultLanguageCode * Changes after CR * Moved DefaultLanguageCodeForContentTest to Integration scope * Removed duplicated suite
- Loading branch information
1 parent
07bd222
commit 94e65e0
Showing
6 changed files
with
103 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
tests/integration/Core/Repository/Values/Content/DefaultLanguageCodeForContentTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Tests\Integration\Core\Repository\Values\Content; | ||
|
||
use eZ\Publish\API\Repository\Tests\BaseTest; | ||
|
||
final class DefaultLanguageCodeForContentTest extends BaseTest | ||
{ | ||
/** | ||
* @throws \eZ\Publish\API\Repository\Exceptions\ForbiddenException | ||
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException | ||
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException | ||
*/ | ||
public function testDefaultLanguageCodeForCreatedContentWithoutPrioritizedLanguage(): void | ||
{ | ||
$names = [ | ||
'eng-GB' => 'Test GB', | ||
'ger-DE' => 'Test DE', | ||
'eng-US' => 'Test US', | ||
]; | ||
$testFolder = $this->createFolder( | ||
$names, | ||
2, | ||
null, | ||
false | ||
); | ||
|
||
self::assertEquals('eng-GB', $testFolder->getDefaultLanguageCode()); | ||
} | ||
|
||
/** | ||
* @throws \eZ\Publish\API\Repository\Exceptions\ForbiddenException | ||
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException | ||
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException | ||
*/ | ||
public function testDefaultLanguageCodeForCreatedContentWithPrioritizedLanguage(): void | ||
{ | ||
$names = [ | ||
'eng-GB' => 'Test GB', | ||
'ger-DE' => 'Test DE', | ||
'eng-US' => 'Test US', | ||
]; | ||
|
||
$testFolder = $this->createFolder( | ||
$names, | ||
2, | ||
null, | ||
false | ||
); | ||
|
||
$repository = $this->getRepository(); | ||
$testFolderInGerman = $repository->getContentService()->loadContent($testFolder->id, ['ger-DE']); | ||
|
||
self::assertEquals('ger-DE', $testFolderInGerman->getDefaultLanguageCode()); | ||
} | ||
} |