-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e5580f
commit 94513e5
Showing
3 changed files
with
62 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
tests/StaticConstructorLoader/DebugStaticConstructorLoaderTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Dbalabka\Enumeration\Tests\StaticConstructorLoader; | ||
|
||
use Dbalabka\StaticConstructorLoader\DebugStaticConstructorLoader; | ||
use Dbalabka\StaticConstructorLoader\StaticConstructorLoader; | ||
use Dbalabka\StaticConstructorLoader\Tests\Fixtures\ChildOfAbstractEnumeration; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\ErrorHandler\DebugClassLoader; | ||
|
||
class DebugStaticConstructorLoaderTest extends TestCase | ||
{ | ||
/** @var callable */ | ||
private $defaultLoader; | ||
|
||
protected function setUp() | ||
{ | ||
$this->defaultLoader = \spl_autoload_functions()[0]; | ||
} | ||
|
||
protected function tearDown() | ||
{ | ||
DebugClassLoader::disable(); | ||
} | ||
|
||
/** | ||
* @runInSeparateProcess | ||
*/ | ||
public function testClassLoadWithDefaultStaticConstrcutorLoader() | ||
{ | ||
new StaticConstructorLoader($this->defaultLoader[0]); | ||
$x = ChildOfAbstractEnumeration::$instance; | ||
$this->assertInstanceOf(ChildOfAbstractEnumeration::class, $x); | ||
} | ||
|
||
/** | ||
* @runInSeparateProcess | ||
*/ | ||
public function testClassLoadWithDefaultStaticConstrcutorLoaderAndSymfonyDebugLoader() | ||
{ | ||
new StaticConstructorLoader($this->defaultLoader[0]); | ||
(new DebugClassLoader($this->defaultLoader))::enable(); | ||
$x = ChildOfAbstractEnumeration::$instance; | ||
$this->assertNull($x); | ||
} | ||
|
||
/** | ||
* @runInSeparateProcess | ||
*/ | ||
public function testClassLoadWithDebugStaticConstrcutorLoaderAndSymfonyDebugLoader() | ||
{ | ||
new DebugStaticConstructorLoader($this->defaultLoader[0]); | ||
(new DebugClassLoader($this->defaultLoader))::enable(); | ||
$x = ChildOfAbstractEnumeration::$instance; | ||
$this->assertInstanceOf(ChildOfAbstractEnumeration::class, $x); | ||
} | ||
} |