-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add FakeApp class and serialization test
The new class FakeApp has been implemented for testing purposes. In addition, new test cases have been added to CompileInjectorTest to verify the correct serialization and deserialization of the new FakeApp class. The serialization test requires PHP version 7.4 or higher.
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 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,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ray\Compiler; | ||
|
||
use Ray\Di\InjectorInterface; | ||
|
||
final class FakeApp | ||
{ | ||
public $injector; | ||
|
||
public function __construct(InjectorInterface $injector) | ||
{ | ||
$this->injector = $injector; | ||
} | ||
|
||
public function __serialize(): array | ||
{ | ||
return ['injector' => $this->injector]; | ||
} | ||
|
||
public function __unserialize(array $data) | ||
{ | ||
$this->injector = $data['injector']; | ||
} | ||
} |