-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Reload objects * Added some more tests * Fixed tests * cs * Fixes * cs
- Loading branch information
Showing
15 changed files
with
193 additions
and
38 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
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,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<files psalm-version="4.3.1@2feba22a005a18bf31d4c7b9bdb9252c73897476"> | ||
<file src="src/ServiceMock.php"> | ||
<UndefinedInterfaceMethod occurrences="1"> | ||
<code>getWrappedValueHolderValue</code> | ||
</UndefinedInterfaceMethod> | ||
</file> | ||
</files> |
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
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
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 |
---|---|---|
|
@@ -2,8 +2,10 @@ | |
|
||
namespace Happyr\ServiceMocking\Test; | ||
|
||
use Happyr\ServiceMocking\ServiceMock; | ||
|
||
/** | ||
* After each tests, make sure we restore the default behavior of all | ||
* After each test, make sure we restore the default behavior of all | ||
* services. | ||
* | ||
* @author Tobias Nyholm <[email protected]> | ||
|
@@ -12,7 +14,7 @@ trait RestoreServiceContainer | |
{ | ||
/** | ||
* @internal | ||
* @before | ||
* @after | ||
*/ | ||
public static function _restoreContainer(): void | ||
{ | ||
|
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 |
---|---|---|
@@ -1,3 +1,12 @@ | ||
happyr_service_mocking: | ||
services: | ||
- 'router' | ||
- 'Happyr\ServiceMocking\Tests\Resource\ExampleService' | ||
|
||
services: | ||
|
||
Happyr\ServiceMocking\Tests\Resource\ExampleService: | ||
public: true | ||
|
||
Happyr\ServiceMocking\Tests\Resource\StatefulService: | ||
tags: | ||
- { name: happyr_service_mock } |
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,4 @@ | ||
services: | ||
|
||
Happyr\ServiceMocking\Tests\Resource\ExampleService: | ||
public: true |
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,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Happyr\ServiceMocking\Tests\Resource; | ||
|
||
class ExampleService | ||
{ | ||
public function getNumber(int $input = 0): int | ||
{ | ||
return 4711 + $input; | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Happyr\ServiceMocking\Tests\Resource; | ||
|
||
class StatefulService | ||
{ | ||
private $data; | ||
|
||
public function getData() | ||
{ | ||
return $this->data; | ||
} | ||
|
||
public function setData($data): void | ||
{ | ||
$this->data = $data; | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
namespace Happyr\ServiceMocking\Tests\Unit\Proxy; | ||
|
||
use Happyr\ServiceMocking\Proxy\ProxyDefinition; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class ProxyDefinitionTest extends TestCase | ||
{ | ||
public function testSwap() | ||
{ | ||
$a = new \stdClass(); | ||
$proxy = new ProxyDefinition($a); | ||
$this->assertSame($a, $proxy->getObject()); | ||
|
||
$b = new \stdClass(); | ||
$proxy->swap($b); | ||
$this->assertSame($b, $proxy->getObject()); | ||
|
||
$proxy->clear(); | ||
$this->assertSame($a, $proxy->getObject()); | ||
} | ||
} |