Skip to content

Commit

Permalink
fixed test error with contao 5
Browse files Browse the repository at this point in the history
  • Loading branch information
koertho committed Oct 29, 2023
1 parent 7d7bac3 commit 3c02ffd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
"symfony/monolog-bridge": "^5.4 || ^6.0",
"symfony/string": "^5.2 || ^6.0",
"tijsverkoyen/css-to-inline-styles": "^2.2",
"twig/twig": "^3.0"
"twig/twig": "^3.0",
"contao/contao": "4.13.*"
},
"require-dev": {
"contao/core-bundle": "4.13.*",
"contao/test-case": "^4.0",
"contao/test-case": "^4.0 || ^5.0",
"contao/manager-plugin": "^2.0",
"heimrichhannot/contao-test-utilities-bundle": "^0.1",
"phpunit/phpunit": "^8.0 || ^9.0",
Expand Down
13 changes: 12 additions & 1 deletion tests/Util/ModelUtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
use Contao\PageModel;
use Contao\System;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Schema;
use HeimrichHannot\UtilsBundle\Tests\AbstractUtilsTestCase;
use HeimrichHannot\UtilsBundle\Tests\Util\Model\CfgTagModel;
use HeimrichHannot\UtilsBundle\Util\ModelUtil;
Expand Down Expand Up @@ -172,7 +174,16 @@ public function testFindParentsRecursively()
{
System::setContainer($this->getContainerWithContaoConfiguration());
System::getContainer()->setParameter('contao.resources_paths', $this->getFixturesPath().'/contao');
System::getContainer()->setParameter('database_connection', $this->createMock(Connection::class));
$connection = $this->createMock(Connection::class);
$connection->method('createSchemaManager')->willReturnCallback(function () {
$schemaManager = $this->createMock(AbstractSchemaManager::class);
$schema = $this->createMock(Schema::class);
$schema->method('getTables')->willReturn([]);
$schemaManager->method('createSchema')->willReturn($schema);
$schemaManager->method('introspectSchema')->willReturn($schema);
return $schemaManager;
});
System::getContainer()->set('database_connection', $connection);
$pageModel = new PageModel();

$pageModel1 = (new PageModel())->setRow(['id' => 1, 'pid' => 0]);
Expand Down

0 comments on commit 3c02ffd

Please sign in to comment.