Skip to content

Instantly share code, notes, and snippets.

@atishgoswami
Last active March 5, 2023 20:41
Show Gist options
  • Save atishgoswami/d56f760647484451d075 to your computer and use it in GitHub Desktop.
Save atishgoswami/d56f760647484451d075 to your computer and use it in GitHub Desktop.
Magento 2 Test App Page
<?php
use Magento\Framework\App\Bootstrap;
require __DIR__ . '../../../app/bootstrap.php';
class TestApp extends \Magento\Framework\App\Http implements \Magento\Framework\AppInterface
{
public function launch()
{
/**
* @var $pluginInstance \Acme\Module\Plugin\Order\Model\TrackStatusPlugin
* @var $order \Magento\Sales\Api\OrderRepositoryInterface
*/
$state = $this->_objectManager->get(
\Magento\Framework\App\State::class
);
$state->setAreaCode(\Magento\Framework\App\Area::AREA_FRONTEND);
$pluginInstance = $this->_objectManager->create(
\Acme\Module\Plugin\Order\Model\TrackStatusPlugin::class
);
$order = $this->_objectManager->create(
\Magento\Sales\Api\OrderRepositoryInterface::class
);
echo get_class($pluginInstance);
exit;
}
/**
* @inheritdoc
*/
public function catchException(Bootstrap $bootstrap, \Exception $exception): bool
{
return false;
}
}
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
$app = $bootstrap->createApplication('TestApp');
$bootstrap->run($app);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment