Created
December 19, 2019 08:38
-
-
Save pedro-stanaka/208bef35847b09789c3475b6a55b9e0b to your computer and use it in GitHub Desktop.
Failing test for Ocramius/ProxyManager
This file contains hidden or 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
--TEST-- | |
Verifies that generated remote object will pass default parameters in method declaration to Adapter. | |
--FILE-- | |
<?php | |
require_once __DIR__ . '/init.php'; | |
use ProxyManager\Factory\RemoteObject\AdapterInterface; | |
interface FooServiceInterface | |
{ | |
public function fooBar(string $requiredParam, string $optionalParam = 'default'); | |
} | |
class Foo implements FooServiceInterface | |
{ | |
public $foo = 'baz'; | |
public function fooBar(string $requiredParam, string $optionalParam = 'default') | |
{ | |
return 'bar'; | |
} | |
} | |
class CustomAdapter implements AdapterInterface | |
{ | |
public function call(string $wrappedClass, string $method, array $params = []) | |
{ | |
return \implode(',', $params); | |
} | |
} | |
$factory = new \ProxyManager\Factory\RemoteObjectFactory(new CustomAdapter(), $configuration); | |
/** @var FooServiceInterface $proxy */ | |
$proxy = $factory->createProxy(FooServiceInterface::class); | |
echo $proxy->fooBar('required') . "\n"; | |
?> | |
--EXPECTF-- | |
required,default |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment