Skip to content

Commit

Permalink
[WIP] Test something
Browse files Browse the repository at this point in the history
  • Loading branch information
dhoffmann1979 committed Dec 9, 2024
1 parent ab6d88d commit 13948fc
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,51 @@ class RunningRequestServiceTest extends FunctionalTestCase
*/
public function testRecordWithMmRecordCanBeMarkedAsPublishing(): void
{
$mmId = '{uid_local: 1, uid_foreign: 2, sorting: 15}';

$mmRecord = new MmDatabaseRecord(
'foo_bar_mm',
$mmId,
['uid_local' => 1, 'uid_foreign' => 2, 'sorting' => 15],
['uid_local' => 1, 'uid_foreign' => 2, 'sorting' => 15],
);

$record = new DatabaseRecord('foo', 1, ['uid' => 1], ['uid' => 1], []);
$record->addChild($mmRecord);

$recordTree = new RecordTree([$record]);

$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
$connection = $connectionPool->getConnectionByName('Default');

$repo = new RunningRequestRepository();
$repo->injectLocalDatabase($connection);
$service = new RunningRequestService();
$service->injectRunningRequestRepository($repo);

$event = new RecursiveRecordPublishingBegan($recordTree);

$service->onRecursiveRecordPublishingBegan($event);

$query = $connection->createQueryBuilder();
$query->select('*')
->from('tx_in2publishcore_running_request')
->where(
$query->expr()->or(
$query->expr()->and(
$query->expr()->eq('record_id', 1),
$query->expr()->eq('table_name', $query->createNamedParameter('foo')),
),
$query->expr()->and(
$query->expr()->eq('record_id', $query->createNamedParameter($mmId)),
$query->expr()->eq('table_name', $query->createNamedParameter('foo_bar_mm')),
),
),
);
$result = $query->executeQuery();
$rows = $result->fetchAllAssociative();
$this->assertCount(2, $rows);
echo '-' . (string)$this->container->get('boot.state')->complete . '-';
// $mmId = '{uid_local: 1, uid_foreign: 2, sorting: 15}';
//
// $mmRecord = new MmDatabaseRecord(
// 'foo_bar_mm',
// $mmId,
// ['uid_local' => 1, 'uid_foreign' => 2, 'sorting' => 15],
// ['uid_local' => 1, 'uid_foreign' => 2, 'sorting' => 15],
// );
//
// $record = new DatabaseRecord('foo', 1, ['uid' => 1], ['uid' => 1], []);
// $record->addChild($mmRecord);
//
// $recordTree = new RecordTree([$record]);
//
// $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
// $connection = $connectionPool->getConnectionByName('Default');
//
// $repo = new RunningRequestRepository();
// $repo->injectLocalDatabase($connection);
// $service = new RunningRequestService();
// $service->injectRunningRequestRepository($repo);
//
// $event = new RecursiveRecordPublishingBegan($recordTree);
//
// $service->onRecursiveRecordPublishingBegan($event);
//
// $query = $connection->createQueryBuilder();
// $query->select('*')
// ->from('tx_in2publishcore_running_request')
// ->where(
// $query->expr()->or(
// $query->expr()->and(
// $query->expr()->eq('record_id', 1),
// $query->expr()->eq('table_name', $query->createNamedParameter('foo')),
// ),
// $query->expr()->and(
// $query->expr()->eq('record_id', $query->createNamedParameter($mmId)),
// $query->expr()->eq('table_name', $query->createNamedParameter('foo_bar_mm')),
// ),
// ),
// );
// $result = $query->executeQuery();
// $rows = $result->fetchAllAssociative();
// $this->assertCount(2, $rows);
$this->assertEquals(1,1);
}
}
2 changes: 1 addition & 1 deletion Tests/FunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ abstract class FunctionalTestCase extends \TYPO3\TestingFramework\Core\Functiona
'typo3/sysext/extensionmanager',
'typo3conf/ext/in2publish_core',
];
private ContainerInterface $container;
protected ContainerInterface $container;
/**
* These two internal variable track if the given test is the first test of
* that test case. This variable is set to current calling test case class.
Expand Down

0 comments on commit 13948fc

Please sign in to comment.