Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,6 @@ compose.override.yaml
###> phpunit/phpunit ###
/phpunit.xml
/.phpunit.result.cache
/.phpunit.cache
###< phpunit/phpunit ###

7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"bobdenotter/configuration-notices": "^1.2",
"bobdenotter/weatherwidget": "^1.1",
"bolt/newswidget": "^1.3",
"dama/doctrine-test-bundle": "^6.6.0",
"dama/doctrine-test-bundle": "^6.0",
"nyholm/psr7": "^1.4",
"ondram/ci-detector": "^4.1",
"php-http/curl-client": "^2.2",
Expand All @@ -108,7 +108,7 @@
"phpstan/phpstan": "^1.2.0",
"phpstan/phpstan-doctrine": "^1.0",
"phpstan/phpstan-symfony": "^1.0.1",
"phpunit/phpunit": "^8.5",
"phpunit/phpunit": "^9.6",
"se/selenium-server-standalone": "^3.141",
"symfony/browser-kit": "^5.4",
"symfony/css-selector": "^5.4",
Expand All @@ -123,7 +123,8 @@
"composer/package-versions-deprecated": true,
"drupol/composer-packages": true,
"symfony/flex": true,
"php-http/discovery": true
"php-http/discovery": true,
"dealerdirect/phpcodesniffer-composer-installer": false
}
},
"extra": {
Expand Down
15 changes: 5 additions & 10 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="phpunit.bootstrap.php"
>
failOnWarning="true"
bootstrap="phpunit.bootstrap.php">
<php>
<ini name="error_reporting" value="-1" force="true"/>
<env name="KERNEL_CLASS" value="Bolt\Kernel"/>
<env name="APP_ENV" value="test" force="true"/>
<env name="APP_DEBUG" value="1" force="true"/>
<env name="APP_SECRET" value="5a79a1c866efef9ca1800f971d689f3e"/>
<env name="SYMFONY_PHPUNIT_VERSION" value="7.2"/>
<env name="SYMFONY_PHPUNIT_VERSION" value="9.6"/>
<!-- define your env variables for the test env here -->

<!-- ###+ doctrine/doctrine-bundle ### -->
<env name="DATABASE_URL" value="sqlite::memory:" force="true"/>
<!-- ###- doctrine/doctrine-bundle ### -->
Expand All @@ -26,15 +24,12 @@
<!-- MAILER_DSN=smtp://localhost -->
<!-- ###- symfony/mailer ### -->
</php>

<testsuites>
<testsuite name="Bolt Test Suite">
<directory>tests/php/</directory>
</testsuite>
</testsuites>

<extensions>
<extension class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension" />
<extension class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension"/>
</extensions>

</phpunit>
6 changes: 0 additions & 6 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,6 @@
"phpunit/php-timer": {
"version": "2.1.2"
},
"phpunit/php-token-stream": {
"version": "3.1.1"
},
"phpunit/phpunit": {
"version": "4.7",
"recipe": {
Expand Down Expand Up @@ -475,9 +472,6 @@
"sebastian/recursion-context": {
"version": "3.0.0"
},
"sebastian/resource-operations": {
"version": "2.0.1"
},
"sebastian/type": {
"version": "1.1.4"
},
Expand Down
4 changes: 2 additions & 2 deletions tests/php/Controller/Backend/ContentEditControllerTest.bak
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ X-Robots-Tag: noindex

public function testCreateNewComplexNestedContent(): void
{
// (2) use self::$container to access the service container
$container = self::$container;
// (2) use self::getContainer() to access the service container
$container = self::getContainer();

$admin = $this->getEm()->getRepository(User::class)->findOneByUsername('admin');
$this->client->loginUser($admin);
Expand Down
21 changes: 17 additions & 4 deletions tests/php/Menu/FrontendMenuBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Bolt\Tests\Menu;

use RuntimeException;
use Bolt\Collection\DeepCollection;
use Bolt\Menu\FrontendMenuBuilder;
use Bolt\Tests\DbAwareTestCase;
Expand Down Expand Up @@ -31,7 +32,7 @@ protected function setUp(): void
{
parent::setUp();

$this->menuBuilder = self::$container->get(FrontendMenuBuilder::class);
$this->menuBuilder = self::getContainer()->get(FrontendMenuBuilder::class);

// Setup mocks for testing the localized menu
$this->twig = $this->createMock(Environment::class);
Expand All @@ -42,17 +43,29 @@ protected function setUp(): void

$this->request->attributes = $this->createMock(ParameterBag::class);
$this->request->attributes
->expects($matcher = $this->atMost(2))
->method('get')
->withConsecutive(['_route'], ['_route_params'])
->willReturn('homepage_locale', []);
->willReturnCallback(function (string $route) use ($matcher) {
if ($matcher->getInvocationCount() === 1) {
$this->assertSame('_route', $route);
return 'homepage_locale';
}

if ($matcher->getInvocationCount() === 2) {
$this->assertSame('_route_params', $route);
return [];
}

throw new RuntimeException('Unexpected call');
});
$this->app = $this->createMock(AppVariable::class);
$this->app->method('getRequest')->willReturn($this->request);
$this->twig->method('getGlobals')->willReturn(['app' => $this->app]);
}

public function testNonExistingMenu(): void
{
$this->expectException(\RuntimeException::class);
$this->expectException(RuntimeException::class);
$this->menuBuilder->buildMenu($this->twig, 'foo');
}

Expand Down
Loading