Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@
"require-dev": {
"behat/behat": "^3.6.1",
"composer-runtime-api": "^2.0",
"dama/doctrine-test-bundle": "^6.7",
"jenner/simple_fork": "^1.2",
"friends-of-behat/mink-extension": "^2.4",
"ibexa/ci-scripts": "^0.2@dev",
"ibexa/code-style": "^1.0",
"ibexa/test-core": "~4.6.x-dev",
"phpunit/phpunit": "^8.2",
"matthiasnoback/symfony-dependency-injection-test": "^4.1",
"symfony/phpunit-bridge": "^5.4",
Expand Down Expand Up @@ -145,7 +147,8 @@
"phpstan": "phpstan analyse",
"integration": [
"Composer\\Config::disableProcessTimeout",
"phpunit -c phpunit-integration-legacy.xml"
"phpunit -c phpunit-integration-legacy.xml",
"phpunit -c phpunit-integration.xml"
],
"test-integration-solr": "phpunit -c phpunit-integration-legacy-solr.xml",
"test": [
Expand Down
11 changes: 11 additions & 0 deletions dependencies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"recipesEndpoint": "",
"packages": [
{
"requirement": "dev-kernel-test-bootstrap-v2 as 4.6.x-dev",
"repositoryUrl": "https://github.com/ibexa/test-core.git",
"package": "ibexa/test-core",
"shouldBeAddedAsVCS": false
}
]
}
17 changes: 17 additions & 0 deletions phpunit-integration-legacy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@
<testsuites>
<testsuite name="integration_core">
<directory>tests/integration/Core</directory>
<!-- Migrated to the ibexa/test-core Bootstrapper; see phpunit-integration.xml -->
<exclude>tests/integration/Core/BasicKernelTest.php</exclude>
<exclude>tests/integration/Core/Repository/SerializationTest.php</exclude>
<exclude>tests/integration/Core/Repository/ContentTypeService/FindContentTypesTest.php</exclude>
<exclude>tests/integration/Core/Repository/ContentService/CopyNonTranslatableFieldsFromPublishedVersionTest.php</exclude>
<exclude>tests/integration/Core/Persistence/Legacy/BookmarkHandlerTest.php</exclude>
<exclude>tests/integration/Core/Repository/ContentService/CopyTranslationsFromPublishedVersionTest.php</exclude>
<exclude>tests/integration/Core/Repository/URLAliasService/UrlAliasLookupTest.php</exclude>
<exclude>tests/integration/Core/Repository/ContentService/ContentUpdateAfterAddingFieldDefinitionTest.php</exclude>
<exclude>tests/integration/Core/Repository/ContentService/UpdateContentTest.php</exclude>
<exclude>tests/integration/Core/Repository/ContentService/ImageAssetTest.php</exclude>
<exclude>tests/integration/Core/Repository/ContentService/LoadVersionInfoTest.php</exclude>
<exclude>tests/integration/Core/Repository/ContentService/DeleteContentTest.php</exclude>
<exclude>tests/integration/Core/Repository/ContentService/MaxLanguagesContentServiceTest.php</exclude>
<exclude>tests/integration/Core/Repository/SearchServiceBookmarkTest.php</exclude>
<exclude>tests/integration/Core/Repository/SearchServiceContentNameTest.php</exclude>
<exclude>tests/integration/Core/Repository/SearchServiceImageTest.php</exclude>
</testsuite>
<testsuite name="integration_debug">
<directory>tests/integration/Debug</directory>
Expand Down
43 changes: 43 additions & 0 deletions phpunit-integration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version = '1.0' encoding = 'utf-8'?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="tests/integration/bootstrap.php"
processIsolation="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
beStrictAboutTestsThatDoNotTestAnything="false"
colors="true"
failOnWarning="true"
>
<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
<ini name="error_reporting" value="-1" />
<env name="DATABASE_URL" value="sqlite://i@i/var/test-bootstrapper.db" />
<env name="KERNEL_CLASS" value="Ibexa\Tests\Integration\Core\TestKernel"/>
<env name="SEARCH_ENGINE" value="legacy"/>
</php>
<testsuites>
<testsuite name="integration_core">
<file>tests/integration/Core/BasicKernelTest.php</file>
<file>tests/integration/Core/Repository/SerializationTest.php</file>
<file>tests/integration/Core/Repository/ContentTypeService/FindContentTypesTest.php</file>
<file>tests/integration/Core/Repository/ContentService/CopyNonTranslatableFieldsFromPublishedVersionTest.php</file>
<file>tests/integration/Core/Persistence/Legacy/BookmarkHandlerTest.php</file>
<file>tests/integration/Core/Repository/ContentService/CopyTranslationsFromPublishedVersionTest.php</file>
<file>tests/integration/Core/Repository/URLAliasService/UrlAliasLookupTest.php</file>
<file>tests/integration/Core/Repository/ContentService/ContentUpdateAfterAddingFieldDefinitionTest.php</file>
<file>tests/integration/Core/Repository/ContentService/UpdateContentTest.php</file>
<file>tests/integration/Core/Repository/ContentService/ImageAssetTest.php</file>
<file>tests/integration/Core/Repository/ContentService/LoadVersionInfoTest.php</file>
<file>tests/integration/Core/Repository/ContentService/DeleteContentTest.php</file>
<file>tests/integration/Core/Repository/ContentService/MaxLanguagesContentServiceTest.php</file>
<file>tests/integration/Core/Repository/SearchServiceBookmarkTest.php</file>
<file>tests/integration/Core/Repository/SearchServiceContentNameTest.php</file>
<file>tests/integration/Core/Repository/SearchServiceImageTest.php</file>
</testsuite>
</testsuites>
<extensions>
<extension class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension" />
</extensions>
</phpunit>
15 changes: 5 additions & 10 deletions tests/integration/Core/BasicKernelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,19 @@
namespace Ibexa\Tests\Integration\Core;

use Ibexa\Contracts\Core\Repository\Repository;
use Ibexa\Contracts\Core\Test\IbexaKernelTestCase;
use Ibexa\Contracts\Test\Core\IbexaKernelTestCase;

/**
* Schema and fixtures are imported once, before the suite runs, by tests/integration/bootstrap.php —
* this test only needs to boot the kernel.
*
* @coversNothing
*/
final class BasicKernelTest extends IbexaKernelTestCase
{
protected function setUp(): void
{
self::bootKernel();

self::loadSchema();
self::loadFixtures();
}

public function testBasicKernelCompiles(): void
{
self::getServiceByClassName(Repository::class);
$this->getIbexaTestCore()->getServiceByClassName(Repository::class);
$this->expectNotToPerformAssertions();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected function setUp(): void
{
parent::setUp();

$this->handler = self::getServiceByClassName(Handler::class);
$this->handler = $this->getIbexaTestCore()->getServiceByClassName(Handler::class);
$this->bookmarkHandler = $this->handler->bookmarkHandler();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ final class ContentUpdateAfterAddingFieldDefinitionTest extends RepositoryTestCa
*/
public function testUpdateFields(): void
{
$contentService = self::getContentService();
$contentTypeService = self::getContentTypeService();
$contentService = $this->getIbexaTestCore()->getContentService();
$contentTypeService = $this->getIbexaTestCore()->getContentTypeService();

// Create new ContentType
$fieldDefCreateStruct = $this->createFieldDefinitionStruct('name', 'Name', true);
Expand Down Expand Up @@ -60,7 +60,7 @@ public function testUpdateFields(): void

private function createFieldDefinitionStruct(string $identifier, string $name, bool $isTranslatable): FieldDefinitionCreateStruct
{
$contentTypeService = self::getContentTypeService();
$contentTypeService = $this->getIbexaTestCore()->getContentTypeService();

$fieldDefCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct(
$identifier,
Expand All @@ -78,7 +78,7 @@ private function createFieldDefinitionStruct(string $identifier, string $name, b

private function createTypeCreateStruct(): ContentTypeCreateStruct
{
$contentTypeService = self::getContentTypeService();
$contentTypeService = $this->getIbexaTestCore()->getContentTypeService();
$typeCreateStruct = $contentTypeService->newContentTypeCreateStruct('multi_lang_drafts');
$typeCreateStruct->mainLanguageCode = 'eng-US';
$typeCreateStruct->names = ['eng-US' => 'Multi lang drafts'];
Expand All @@ -91,9 +91,9 @@ private function createTypeCreateStruct(): ContentTypeCreateStruct
*/
protected function createNewContent(string $name, array $languages = ['eng-US'], int $parentLocationId = 2): Content
{
$contentTypeService = self::getContentTypeService();
$contentService = self::getContentService();
$locationService = self::getLocationService();
$contentTypeService = $this->getIbexaTestCore()->getContentTypeService();
$contentService = $this->getIbexaTestCore()->getContentService();
$locationService = $this->getIbexaTestCore()->getLocationService();

$contentType = $contentTypeService->loadContentTypeByIdentifier('multi_lang_drafts');
$createStruct = $contentService->newContentCreateStruct($contentType, $languages[0]);
Expand All @@ -113,7 +113,7 @@ protected function createNewContent(string $name, array $languages = ['eng-US'],
*/
protected function createUpdateStruct(Content $content, string $translatedName, array $languages): ContentUpdateStruct
{
$contentService = self::getContentService();
$contentService = $this->getIbexaTestCore()->getContentService();

$updateStruct = $contentService->newContentUpdateStruct();
$updateStruct->initialLanguageCode = $languages[0];
Expand All @@ -135,15 +135,15 @@ protected function createUpdateStruct(Content $content, string $translatedName,

protected function createContentDraft(Content $content, string $languageCode): Content
{
$contentLanguageService = self::getLanguageService();
$contentLanguageService = $this->getIbexaTestCore()->getLanguageService();

$language = $contentLanguageService->loadLanguage($languageCode);

return self::getContentService()->createContentDraft($content->contentInfo, null, null, $language);
return $this->getIbexaTestCore()->getContentService()->createContentDraft($content->contentInfo, null, null, $language);
}

protected function updateContent(Content $draft, ContentUpdateStruct $updateStruct): Content
{
return self::getContentService()->updateContent($draft->versionInfo, $updateStruct);
return $this->getIbexaTestCore()->getContentService()->updateContent($draft->versionInfo, $updateStruct);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testCopyNonTranslatableFieldsFromPublishedVersionToDraft(): void
{
$this->createNonTranslatableContentType();

$contentService = self::getContentService();
$contentService = $this->getIbexaTestCore()->getContentService();

// Creating start content in eng-US language
$contentDraft = $this->createEngDraft();
Expand Down Expand Up @@ -81,7 +81,7 @@ public function testCopyNonTranslatableFieldsTwoParallelDrafts(): void
{
$this->createNonTranslatableContentType();

$contentService = self::getContentService();
$contentService = $this->getIbexaTestCore()->getContentService();

// Creating start content in eng-US language
$contentDraft = $this->createEngDraft();
Expand Down Expand Up @@ -124,7 +124,7 @@ public function testCopyNonTranslatableFieldsOverridesNonMainLanguageDrafts(): v
{
$this->createNonTranslatableContentType();

$contentService = self::getContentService();
$contentService = $this->getIbexaTestCore()->getContentService();

// Creating start content in eng-US language
$contentDraft = $this->createEngDraft();
Expand Down Expand Up @@ -167,9 +167,9 @@ public function testCopyNonTranslatableFieldsOverridesNonMainLanguageDrafts(): v

private function createEngDraft(): Content
{
$contentService = self::getContentService();
$contentTypeService = self::getContentTypeService();
$locationService = self::getLocationService();
$contentService = $this->getIbexaTestCore()->getContentService();
$contentTypeService = $this->getIbexaTestCore()->getContentTypeService();
$locationService = $this->getIbexaTestCore()->getLocationService();

$contentType = $contentTypeService->loadContentTypeByIdentifier(self::CONTENT_TYPE_IDENTIFIER);
$mainLanguageCode = self::ENG_US;
Expand All @@ -187,8 +187,8 @@ private function createEngDraft(): Content

private function createNonTranslatableContentType(): void
{
$permissionResolver = self::getPermissionResolver();
$contentTypeService = self::getContentTypeService();
$permissionResolver = $this->getIbexaTestCore()->getPermissionResolver();
$contentTypeService = $this->getIbexaTestCore()->getContentTypeService();

$typeCreate = $contentTypeService->newContentTypeCreateStruct(self::CONTENT_TYPE_IDENTIFIER);

Expand Down Expand Up @@ -245,7 +245,7 @@ private function buildFieldDefinitionCreateStructForNonTranslatableContentType(
bool $isRequired,
?string $defaultValue = null
): FieldDefinitionCreateStruct {
$contentTypeService = self::getContentTypeService();
$contentTypeService = $this->getIbexaTestCore()->getContentTypeService();

$fieldDefinitionCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct(
$fieldIdentifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public function testCopyTranslationsFromPublishedVersionCopiesEmptyValues(): voi
{
$this->createContentType();

$contentService = self::getContentService();
$contentTypeService = self::getContentTypeService();
$locationService = self::getLocationService();
$contentService = $this->getIbexaTestCore()->getContentService();
$contentTypeService = $this->getIbexaTestCore()->getContentTypeService();
$locationService = $this->getIbexaTestCore()->getLocationService();

// Creating and publishing content in eng-GB language
$contentType = $contentTypeService->loadContentTypeByIdentifier(self::CONTENT_TYPE_IDENTIFIER);
Expand Down Expand Up @@ -86,8 +86,8 @@ public function testCopyTranslationsFromPublishedVersionCopiesEmptyValues(): voi

private function createContentType(): void
{
$permissionResolver = self::getPermissionResolver();
$contentTypeService = self::getContentTypeService();
$permissionResolver = $this->getIbexaTestCore()->getPermissionResolver();
$contentTypeService = $this->getIbexaTestCore()->getContentTypeService();

$typeCreate = $contentTypeService->newContentTypeCreateStruct(self::CONTENT_TYPE_IDENTIFIER);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Ibexa\Tests\Integration\Core\Repository\ContentService;

use Ibexa\Contracts\Core\Repository\TrashService;
use Ibexa\Contracts\Core\Repository\Values\Content\Content;
use Ibexa\Tests\Integration\Core\RepositoryTestCase;
use PHPUnit\Framework\Assert;
Expand All @@ -22,7 +23,7 @@ final class DeleteContentTest extends RepositoryTestCase
*/
public function testDeleteContentDeletesChildrenDrafts(): void
{
$contentService = self::getContentService();
$contentService = $this->getIbexaTestCore()->getContentService();

[$folder, $draft1, $draft2, $draft3, $draftSecondDepth] = $this->prepareContentStructure();

Expand All @@ -43,15 +44,15 @@ public function testDeleteContentDeletesChildrenDrafts(): void
*/
public function testTrashLocationDeletesChildrenDrafts(): void
{
$trashService = self::getTrashService();
$contentService = self::getContentService();
$trashService = $this->getIbexaTestCore()->getServiceByClassName(TrashService::class);
$contentService = $this->getIbexaTestCore()->getContentService();

[$folder, $draft1, $draft2, $draft3, $draftSecondDepth] = $this->prepareContentStructure();

$folderMainLocationId = $folder->getVersionInfo()->getContentInfo()->getMainLocationId();
Assert::assertIsNumeric($folderMainLocationId);

$locationToTrash = self::getLocationService()->loadLocation($folderMainLocationId);
$locationToTrash = $this->getIbexaTestCore()->getLocationService()->loadLocation($folderMainLocationId);

$trashService->trash($locationToTrash);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ protected function setUp(): void
{
parent::setUp();

$this->contentService = self::getContentService();
$this->contentTypeService = self::getContentTypeService();
$this->contentService = $this->getIbexaTestCore()->getContentService();
$this->contentTypeService = $this->getIbexaTestCore()->getContentTypeService();
}

public function testAssetRelationIsRemoved(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class LoadVersionInfoTest extends RepositoryTestCase
*/
public function testLoadVersionInfoListByContentInfo(): void
{
$contentService = self::getContentService();
$contentService = $this->getIbexaTestCore()->getContentService();

$folder1 = $this->createFolder(['eng-GB' => 'Folder1'], 2);
$folder2 = $this->createFolder(['eng-GB' => 'Folder2'], 2);
Expand All @@ -45,8 +45,8 @@ public function testLoadVersionInfoListByContentInfo(): void

public function testLoadVersionInfoListByContentInfoForTopLevelNode(): void
{
$contentService = self::getContentService();
$locationService = self::getLocationService();
$contentService = $this->getIbexaTestCore()->getContentService();
$locationService = $this->getIbexaTestCore()->getLocationService();

$location = $locationService->loadLocation(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function testCreateContent(): void
*/
private function prepareMaxLanguages(): void
{
$languageService = self::getLanguageService();
$languageService = $this->getIbexaTestCore()->getLanguageService();

foreach (self::$languagesRawList as $languageData) {
$languageCreateStruct = $languageService->newLanguageCreateStruct();
Expand Down
Loading
Loading