Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPUnit 10.3 #507

Merged
merged 1 commit into from
Aug 23, 2023
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/.phpcs-cache
/.phpunit.result.cache
/.phpunit.cache
/.webpack-build
/build-*
/config/local.yml
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-phpunit": "^1.2",
"phpstan/phpstan-strict-rules": "^1.4",
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^10.3",
"symfony/css-selector": "^6.3",
"symfony/dom-crawler": "^6.3",
"symfony/error-handler": "^6.3",
Expand Down
562 changes: 255 additions & 307 deletions composer.lock

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
verbose="true"
beStrictAboutOutputDuringTests="true"
cacheDirectory=".phpunit.cache"
>
<coverage/>
<testsuites>
<testsuite name="Doctrine Website Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<source>
<include>
<directory>./lib</directory>
</whitelist>
</filter>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion tests/Cache/CacheClearerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function setUp(): void
$this->rootDir,
$this->env,
])
->setMethods(['glob'])
->onlyMethods(['glob'])
->getMock();
}
}
5 changes: 3 additions & 2 deletions tests/Docs/CodeBlockRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Doctrine\Website\Docs\CodeBlockRenderer;
use Doctrine\Website\Docs\CodeBlockWithLineNumbersRenderer;
use Doctrine\Website\Tests\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\MockObject\MockObject;

class CodeBlockRendererTest extends TestCase
Expand Down Expand Up @@ -36,7 +37,7 @@ public function testRenderCodeBlockWithLineNumbers(): void
self::assertSame('expected', $this->codeBlockRenderer->render($lines, $language));
}

/** @dataProvider getConsoleLanguages */
#[DataProvider('getConsoleLanguages')]
public function testRenderConsole(string $consoleLanguage): void
{
$lines = [
Expand All @@ -54,7 +55,7 @@ public function testRenderConsole(string $consoleLanguage): void
}

/** @return string[][] */
public function getConsoleLanguages(): array
public static function getConsoleLanguages(): array
{
return [
['console'],
Expand Down
2 changes: 1 addition & 1 deletion tests/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function testFunctional(): void
self::assertCount(3, $crawler->filter('nav.breadcrumbs ol.breadcrumb li.breadcrumb-item'));
}

self::assertFileNotExists($this->getFullPath(sprintf(
self::assertFileDoesNotExist($this->getFullPath(sprintf(
'/projects/%s/en/current/meta.php',
$project->getDocsSlug(),
)));
Expand Down
2 changes: 1 addition & 1 deletion tests/Twig/ProjectExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function setUp(): void
$this->projectRepository,
'',
])
->setMethods(['fileExists'])
->onlyMethods(['fileExists'])
->getMock();
}

Expand Down
17 changes: 10 additions & 7 deletions tests/WebsiteBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function setUp(): void
$this->cacheDir,
$this->webpackBuildDir,
])
->setMethods(['filePutContents'])
->onlyMethods(['filePutContents'])
->getMock();
}

Expand All @@ -82,13 +82,16 @@ public function testBuild(): void
->method('run')
->with('cd /data/doctrine-website-build-staging && npm run build');

$this->filesystem->expects(self::exactly(2))
->method('mirror')
->withConsecutive(
[$this->webpackBuildDir, $buildDir . '/frontend'],
[$this->cacheDir . '/data', $buildDir . '/website-data'],
);
$mirrored = [];

$this->filesystem->method('mirror')
->willReturnCallback(static function (string $originDir, string $targetDir) use (&$mirrored): void {
$mirrored[$originDir] = $targetDir;
});

$this->websiteBuilder->build($output, $buildDir, $env);

self::assertSame($buildDir . '/frontend', $mirrored[$this->webpackBuildDir]);
self::assertSame($buildDir . '/website-data', $mirrored[$this->cacheDir . '/data']);
}
}
Loading