-
-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[generator] make import tests into a unit test
When we run safe with multiple different PHP versions, we want to make sure importing the library works under all versions - not just the version we generate with
- Loading branch information
Showing
2 changed files
with
42 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
final class GeneratedFilesTest extends TestCase | ||
{ | ||
public function testRequireModules(): void | ||
{ | ||
self::expectNotToPerformAssertions(); | ||
|
||
$files = \glob(__DIR__.'/../generated/*.php'); | ||
if ($files === false) { | ||
throw new \RuntimeException('Failed to require the generated file'); | ||
} | ||
|
||
foreach ($files as $file) { | ||
require_once($file); | ||
} | ||
} | ||
|
||
public function testRequireExceptions(): void | ||
{ | ||
self::expectNotToPerformAssertions(); | ||
|
||
$files = \glob(__DIR__.'/../generated/Exceptions/*.php'); | ||
if ($files === false) { | ||
throw new \RuntimeException('Failed to require the generated exception file'); | ||
} | ||
foreach ($files as $file) { | ||
require_once($file); | ||
} | ||
} | ||
|
||
public function testRequireExceptionInterface(): void | ||
{ | ||
self::expectNotToPerformAssertions(); | ||
|
||
require_once __DIR__.'/../lib/Exceptions/SafeExceptionInterface.php'; | ||
} | ||
} |