Skip to content

Commit

Permalink
BUGFIX: Fix Neos.ContentRepository.LegacyNodeMigration behat tests
Browse files Browse the repository at this point in the history
and run them in CI

Related: #4455
  • Loading branch information
bwaidelich committed Sep 22, 2023
1 parent 0538da9 commit 362462c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/postgresql-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,4 @@ jobs:
FLOW_CONTEXT=Testing/Behat ./flow doctrine:migrationversion --add --version all
bin/behat --stop-on-failure -f progress -c Packages/Neos/Neos.Neos/Tests/Behavior/behat.yml.dist --tags ~@browser
bin/behat --stop-on-failure -f progress -c Packages/Neos/Neos.ContentRepository/Tests/Behavior/behat.yml.dist
bin/behat --stop-on-failure -f progress -c Packages/Neos/Neos.ContentRepository.LegacyNodeMigration/Tests/Behavior/behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@
use League\Flysystem\Filesystem;
use League\Flysystem\InMemory\InMemoryFilesystemAdapter;
use Neos\Behat\Tests\Behat\FlowContextTrait;
use Neos\ContentGraph\DoctrineDbalAdapter\Tests\Behavior\Features\Bootstrap\ProjectionIntegrityViolationDetectionTrait;
use Neos\ContentRepository\BehavioralTests\TestSuite\Behavior\CRBehavioralTestsSubjectProvider;
use Neos\ContentRepository\BehavioralTests\TestSuite\Behavior\GherkinPyStringNodeBasedNodeTypeManagerFactory;
use Neos\ContentRepository\BehavioralTests\TestSuite\Behavior\GherkinTableNodeBasedContentDimensionSourceFactory;
use Neos\ContentRepository\Core\ContentRepository;
use Neos\ContentRepository\Core\EventStore\EventNormalizer;
use Neos\ContentRepository\Core\Factory\ContentRepositoryId;
use Neos\ContentRepository\Core\Factory\ContentRepositoryServiceFactoryInterface;
use Neos\ContentRepository\Core\Factory\ContentRepositoryServiceInterface;
use Neos\ContentRepository\TestSuite\Behavior\Features\Bootstrap\CRTestSuiteTrait;
use Neos\ContentRepository\Export\Asset\AssetExporter;
use Neos\ContentRepository\Export\Asset\AssetLoaderInterface;
Expand All @@ -26,9 +33,11 @@
use Neos\ContentRepository\LegacyNodeMigration\NodeDataToEventsProcessor;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\ContentRepositoryRegistry\TestSuite\Behavior\CRRegistrySubjectProvider;
use Neos\Flow\Property\PropertyMapper;
use Neos\Flow\ResourceManagement\PersistentResource;
use Neos\Flow\Tests\Behavior\Features\Bootstrap\IsolatedBehatStepsTrait;
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\MockObject\Generator as MockGenerator;

Expand All @@ -38,8 +47,10 @@
class FeatureContext implements Context
{
use FlowContextTrait;
#use IsolatedBehatStepsTrait;
#use ProjectionIntegrityViolationDetectionTrait;
use CRTestSuiteTrait;
use CRRegistrySubjectProvider;
use CRBehavioralTestsSubjectProvider;

protected $isolated = false;

Expand All @@ -55,16 +66,19 @@ class FeatureContext implements Context

private ContentRepository $contentRepository;

protected ContentRepositoryRegistry $contentRepositoryRegistry;

public function __construct()
{
if (self::$bootstrap === null) {
self::$bootstrap = $this->initializeFlow();
}
$this->objectManager = self::$bootstrap->getObjectManager();
$this->contentRepositoryRegistry = $this->objectManager->get(ContentRepositoryRegistry::class);

$this->mockFilesystemAdapter = new InMemoryFilesystemAdapter();
$this->mockFilesystem = new Filesystem($this->mockFilesystemAdapter);
$this->setupCRTestSuiteTrait();

}

/**
Expand Down Expand Up @@ -345,4 +359,24 @@ private function parseJsonTable(TableNode $table): array
}, $row);
}, $table->getHash());
}

protected function getContentRepositoryService(
ContentRepositoryServiceFactoryInterface $factory
): ContentRepositoryServiceInterface {
return $this->contentRepositoryRegistry->buildService(
$this->currentContentRepository->id,
$factory
);
}

protected function createContentRepository(
ContentRepositoryId $contentRepositoryId
): ContentRepository {
$this->contentRepositoryRegistry->resetFactoryInstance($contentRepositoryId);
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
GherkinTableNodeBasedContentDimensionSourceFactory::reset();
GherkinPyStringNodeBasedNodeTypeManagerFactory::reset();

return $contentRepository;
}
}

0 comments on commit 362462c

Please sign in to comment.