Created
August 12, 2018 18:27
-
-
Save adrian-martinez-interactiv4/38bca4531085093f3c99553ff936d478 to your computer and use it in GitHub Desktop.
Test Proxy generation return type
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
<?php | |
use Magento\Framework\App\Area; | |
require __DIR__ . '/app/bootstrap.php'; | |
/** | |
* Class Hello | |
*/ | |
class Hello | |
{ | |
/** | |
* @return string | |
*/ | |
public function sayHello(): string | |
{ | |
return "Hello !!"; | |
} | |
} | |
/** | |
* Class ProxyTestApp | |
*/ | |
class ProxyTestApp extends \Magento\Framework\App\Http implements \Magento\Framework\AppInterface | |
{ | |
public function launch() | |
{ | |
$this->_state->setAreaCode(Area::AREA_GLOBAL); | |
$this->_objectManager->configure($this->_configLoader->load(Area::AREA_GLOBAL)); | |
/** @var Hello $helloProxy */ | |
$helloProxy = $this->_objectManager->get(\Hello::class . '\Proxy'); | |
$this->_response->setBody($helloProxy->sayHello()); | |
//the method must end with this line | |
return $this->_response; | |
} | |
public function catchException(\Magento\Framework\App\Bootstrap $bootstrap, \Exception $exception) | |
{ | |
return false; | |
} | |
} | |
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER); | |
/** @var \Magento\Framework\App\Http $app */ | |
$app = $bootstrap->createApplication('ProxyTestApp'); | |
$bootstrap->run($app); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment