public function load() { $this->evalClass($this->classmetadata); $builder = new ProxyBuilder(); $builder->setNamespace($this->classmetadata->getNamespace()); $builder->setClassName($this->originalClassName); $builder->setParentClass("\\" . $this->classmetadata->getNamespace() . "\\" . $this->classmetadata->getName()); foreach ($this->classmetadata->getMethods() as $method) { $builder->addMethod($method); } $builder->loadProxy(); }
public function testProxyPassesConstructorArguments() { $this->loadBaseClass('SomeClassWithConstructorArguments'); $builder = new ProxyBuilder(); $builder->setNamespace('PHPRealCoverage\\Proxy'); $builder->setClassName('SomeClassWithConstructorArguments'); $builder->setParentClass('\\PHPRealCoverage\\Proxy\\SomeClassWithConstructorArguments_original'); $builder->addMethod('getSomeParameter'); $builder->loadProxy(); $instance = new SomeClassWithConstructorArguments('passedByConstructor'); $this->assertEquals('passedByConstructor', $instance->getSomeParameter()); }