8000 New PHPUnit assertions for the WebTestCase by fabpot · Pull Request #30813 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

New PHPUnit assertions for the WebTestCase #30813

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

Merged
merged 2 commits into from
Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Create new PHPUnit assertions for the WebTestCase
  • Loading branch information
Pierstoval authored and fabpot committed Apr 1, 2019
commit 2f8040ee843324b07f73af75ff02dd00844842b9
7 changes: 6 additions & 1 deletion src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
abstract class KernelTestCase extends TestCase
{
use KernelShutdownOnTearDownTrait;
use TestCaseSetUpTearDownTrait;

protected static $class;

Expand All @@ -37,6 +37,11 @@ abstract class KernelTestCase extends TestCase
*/
protected static $container;

protected function doTearDown(): void
{
static::ensureKernelShutdown();
}

/**
* @return string The Kernel class name
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,60 @@

use PHPUnit\Framework\TestCase;

// Auto-adapt to PHPUnit 8 that added a `void` return-type to the tearDown method
// Auto-adapt to PHPUnit 8 that added a `void` return-type to the setUp/tearDown methods

if ((new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) {
/**
* @internal
*/
trait KernelShutdownOnTearDownTrait
trait TestCaseSetUpTearDownTrait
{
private function doSetUp(): void
{
}

private function doTearDown(): void
{
}

protected function setUp(): void
{
$this->doSetUp();
}

protected function tearDown(): void
{
static::ensureKernelShutdown();
$this->doTearDown();
}
}
} else {
/**
* @internal
*/
trait KernelShutdownOnTearDownTrait
trait TestCaseSetUpTearDownTrait
{
private function doSetUp(): void
{
}

private function doTearDown(): void
{
}

/**
* @return void
*/
protected function setUp()
{
$this->doSetUp();
}

/**
* @return void
*/
protected function tearDown()
{
static::ensureKernelShutdown();
$this->doTearDown();
}
}
}
Loading
0