Skip to content

Commit

Permalink
Inline simplified testing helper method alias
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Sep 8, 2024
1 parent 542f05c commit e17c37f
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/framework/tests/Unit/AssetServiceUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AssetServiceUnitTest extends UnitTestCase
{
protected function setUp(): void
{
self::needsKernel();
self::resetKernel();
self::mockConfig();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class BaseFoundationCollectionTest extends UnitTestCase
{
public function testInit()
{
$this->needsKernel();
$this->resetKernel();

$booted = BaseFoundationCollectionTestClass::init(HydeKernel::getInstance())->boot();

Expand Down
2 changes: 1 addition & 1 deletion packages/framework/tests/Unit/BreadcrumbsComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class BreadcrumbsComponentTest extends UnitTestCase
{
protected function setUp(): void
{
self::needsKernel();
self::resetKernel();
self::mockConfig();
}

Expand Down
4 changes: 2 additions & 2 deletions packages/framework/tests/Unit/BuildTaskUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function testCanWriteToOutput()

public function testCreatedSiteFile()
{
self::needsKernel();
self::resetKernel();

$task = new BufferedTestBuildTask();

Expand All @@ -164,7 +164,7 @@ public function testCreatedSiteFile()

public function testCreatedSiteFileWithAbsolutePath()
{
self::needsKernel();
self::resetKernel();

$task = new BufferedTestBuildTask();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function setUp(): void
{
parent::setUp();

self::needsKernel();
self::resetKernel();

$this->html ??= file_get_contents(Hyde::vendorPath('resources/views/homepages/welcome.blade.php'));
}
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/tests/Unit/NavItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class NavItemTest extends UnitTestCase
{
public static function setUpBeforeClass(): void
{
self::needsKernel();
self::resetKernel();
self::mockConfig();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class NavigationDataFactoryUnitTest extends UnitTestCase
{
protected function setUp(): void
{
self::needsKernel();
self::resetKernel();
self::mockConfig();
}

Expand Down
2 changes: 1 addition & 1 deletion packages/framework/tests/Unit/UnixsumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function testMethodReturnsSameValueForStringWithMixedEndOfLineSequences()

public function testMethodReturnsSameValueWhenLoadedFromFileUsingShorthand()
{
self::needsKernel();
self::resetKernel();

$string = "foo\nbar\r\nbaz\r\n";

Expand Down
2 changes: 1 addition & 1 deletion packages/hyde/tests/DefaultContentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DefaultContentTest extends UnitTestCase
{
public static function setUpBeforeClass(): void
{
self::needsKernel();
self::resetKernel();
}

public function testDefaultPagesArePresent()
Expand Down
7 changes: 1 addition & 6 deletions packages/testing/src/UnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,10 @@ abstract class UnitTestCase extends BaseTestCase
protected static bool $needsConfig = false;
protected static bool $needsRender = false;

protected static function needsKernel(): void
{
self::setupKernel();
}

public static function setUpBeforeClass(): void
{
if (static::$needsKernel) {
self::needsKernel();
self::resetKernel();
}

if (static::$needsConfig) {
Expand Down

0 comments on commit e17c37f

Please sign in to comment.