This repository has been archived by the owner on Feb 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core-1652 replaced slow Presentation with an example of a fast functi…
…onal Controller test
- Loading branch information
Showing
11 changed files
with
263 additions
and
3,081 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
178 changes: 178 additions & 0 deletions
178
tests/PyzTest/Shared/Testify/_support/Helper/Bootstrap/YvesBootstrap.php
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,178 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Spryker Demoshop. | ||
* For full license information, please view the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace PyzTest\Shared\Testify\Helper\Bootstrap; | ||
|
||
use Pyz\Shared\Application\Business\Routing\SilexRouter; | ||
use Pyz\Shared\Application\Plugin\Provider\WebProfilerServiceProvider; | ||
use Pyz\Yves\Application\Plugin\Provider\ApplicationControllerProvider; | ||
use Pyz\Yves\Application\Plugin\Provider\ApplicationServiceProvider; | ||
use Pyz\Yves\Application\Plugin\Provider\AutoloaderCacheServiceProvider; | ||
use Pyz\Yves\Application\Plugin\Provider\LanguageServiceProvider; | ||
use Pyz\Yves\Application\Plugin\Provider\YvesSecurityServiceProvider; | ||
use Pyz\Yves\Calculation\Plugin\Provider\CalculationControllerProvider; | ||
use Pyz\Yves\Cart\Plugin\Provider\CartControllerProvider; | ||
use Pyz\Yves\Cart\Plugin\Provider\CartServiceProvider; | ||
use Pyz\Yves\Catalog\Plugin\Provider\CatalogControllerProvider; | ||
use Pyz\Yves\Category\Plugin\Provider\CategoryServiceProvider; | ||
use Pyz\Yves\Checkout\Plugin\Provider\CheckoutControllerProvider; | ||
use Pyz\Yves\Collector\Plugin\Router\StorageRouter; | ||
use Pyz\Yves\Customer\Plugin\Provider\CustomerControllerProvider; | ||
use Pyz\Yves\Customer\Plugin\Provider\CustomerSecurityServiceProvider; | ||
use Pyz\Yves\Glossary\Plugin\Provider\TranslationServiceProvider; | ||
use Pyz\Yves\Heartbeat\Plugin\Provider\HeartbeatControllerProvider; | ||
use Pyz\Yves\Newsletter\Plugin\Provider\NewsletterControllerProvider; | ||
use Pyz\Yves\ProductNew\Plugin\Provider\ProductNewControllerProvider; | ||
use Pyz\Yves\ProductSale\Plugin\Provider\ProductSaleControllerProvider; | ||
use Pyz\Yves\ProductSet\Plugin\Provider\ProductSetControllerProvider; | ||
use Pyz\Yves\Twig\Plugin\Provider\TwigServiceProvider; | ||
use Pyz\Yves\Wishlist\Plugin\Provider\WishlistControllerProvider; | ||
use Silex\Provider\FormServiceProvider; | ||
use Silex\Provider\HttpFragmentServiceProvider; | ||
use Silex\Provider\RememberMeServiceProvider; | ||
use Silex\Provider\SecurityServiceProvider; | ||
use Silex\Provider\ServiceControllerServiceProvider; | ||
use Silex\Provider\SessionServiceProvider; | ||
use Silex\Provider\ValidatorServiceProvider; | ||
use Spryker\Shared\Application\ApplicationConstants; | ||
use Spryker\Shared\Application\ServiceProvider\FormFactoryServiceProvider; | ||
use Spryker\Shared\Application\ServiceProvider\HeadersSecurityServiceProvider; | ||
use Spryker\Shared\Application\ServiceProvider\RoutingServiceProvider; | ||
use Spryker\Shared\Application\ServiceProvider\UrlGeneratorServiceProvider; | ||
use Spryker\Shared\Config\Config; | ||
use Spryker\Yves\Application\Plugin\Provider\CookieServiceProvider; | ||
use Spryker\Yves\Application\Plugin\Provider\ExceptionServiceProvider; | ||
use Spryker\Yves\Application\Plugin\Provider\YvesHstsServiceProvider; | ||
use Spryker\Yves\CmsContentWidget\Plugin\CmsContentWidgetServiceProvider; | ||
use Spryker\Yves\Kernel\Application; | ||
use Spryker\Yves\Messenger\Plugin\Provider\FlashMessengerServiceProvider; | ||
use Spryker\Yves\Money\Plugin\ServiceProvider\TwigMoneyServiceProvider; | ||
use Spryker\Yves\Navigation\Plugin\Provider\NavigationTwigServiceProvider; | ||
use Spryker\Yves\NewRelic\Plugin\ServiceProvider\NewRelicRequestTransactionServiceProvider; | ||
use Spryker\Yves\ProductGroup\Plugin\Provider\ProductGroupTwigServiceProvider; | ||
use Spryker\Yves\ProductLabel\Plugin\Provider\ProductLabelTwigServiceProvider; | ||
use Spryker\Yves\ProductRelation\Plugin\ProductRelationTwigServiceProvider; | ||
use Spryker\Yves\Session\Plugin\ServiceProvider\SessionServiceProvider as SprykerSessionServiceProvider; | ||
use Spryker\Yves\Storage\Plugin\Provider\StorageCacheServiceProvider; | ||
use Spryker\Yves\Twig\Plugin\ServiceProvider\TwigServiceProvider as SprykerTwigServiceProvider; | ||
|
||
class YvesBootstrap | ||
{ | ||
|
||
/** | ||
* @var \Spryker\Yves\Kernel\Application | ||
*/ | ||
protected $application; | ||
|
||
public function __construct() | ||
{ | ||
$this->application = new Application(); | ||
} | ||
|
||
/** | ||
* @return \Spryker\Yves\Kernel\Application | ||
*/ | ||
public function boot() | ||
{ | ||
$this->registerServiceProviders(); | ||
|
||
$this->registerRouters(); | ||
|
||
$this->registerControllerProviders(); | ||
|
||
return $this->application; | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
protected function registerServiceProviders() | ||
{ | ||
$this->application->register(new StorageCacheServiceProvider()); | ||
$this->application->register(new SprykerTwigServiceProvider()); | ||
$this->application->register(new TwigServiceProvider()); | ||
$this->application->register(new ApplicationServiceProvider()); | ||
$this->application->register(new SessionServiceProvider()); | ||
$this->application->register(new SprykerSessionServiceProvider()); | ||
$this->application->register(new SecurityServiceProvider()); | ||
$this->application->register(new CustomerSecurityServiceProvider()); | ||
$this->application->register(new YvesSecurityServiceProvider()); | ||
$this->application->register(new ExceptionServiceProvider()); | ||
$this->application->register(new NewRelicRequestTransactionServiceProvider()); | ||
$this->application->register(new CookieServiceProvider()); | ||
$this->application->register(new UrlGeneratorServiceProvider()); | ||
$this->application->register(new ServiceControllerServiceProvider()); | ||
$this->application->register(new RememberMeServiceProvider()); | ||
$this->application->register(new RoutingServiceProvider()); | ||
$this->application->register(new TranslationServiceProvider()); | ||
$this->application->register(new ValidatorServiceProvider()); | ||
$this->application->register(new FormServiceProvider()); | ||
$this->application->register(new HttpFragmentServiceProvider()); | ||
$this->application->register(new CategoryServiceProvider()); | ||
$this->application->register(new FlashMessengerServiceProvider()); | ||
$this->application->register(new HeadersSecurityServiceProvider()); | ||
$this->application->register(new WebProfilerServiceProvider()); | ||
$this->application->register(new AutoloaderCacheServiceProvider()); | ||
$this->application->register(new YvesHstsServiceProvider()); | ||
$this->application->register(new CartServiceProvider()); | ||
$this->application->register(new FormFactoryServiceProvider()); | ||
$this->application->register(new LanguageServiceProvider()); | ||
$this->application->register(new TwigMoneyServiceProvider()); | ||
$this->application->register(new ProductRelationTwigServiceProvider()); | ||
$this->application->register(new NavigationTwigServiceProvider()); | ||
$this->application->register(new ProductGroupTwigServiceProvider()); | ||
$this->application->register(new ProductLabelTwigServiceProvider()); | ||
$this->application->register(new CmsContentWidgetServiceProvider()); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
protected function registerRouters() | ||
{ | ||
$this->application->addRouter((new StorageRouter())->setSsl(false)); | ||
$this->application->addRouter(new SilexRouter($this->application)); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
protected function registerControllerProviders() | ||
{ | ||
$isSsl = Config::get(ApplicationConstants::YVES_SSL_ENABLED); | ||
|
||
$controllerProviders = $this->getControllerProviderStack($isSsl); | ||
|
||
foreach ($controllerProviders as $controllerProvider) { | ||
$this->application->mount($controllerProvider->getUrlPrefix(), $controllerProvider); | ||
} | ||
} | ||
|
||
/** | ||
* @param bool|null $isSsl | ||
* | ||
* @return \Pyz\Yves\Application\Plugin\Provider\AbstractYvesControllerProvider[] | ||
*/ | ||
protected function getControllerProviderStack($isSsl) | ||
{ | ||
return [ | ||
new ApplicationControllerProvider($isSsl), | ||
new CheckoutControllerProvider($isSsl), | ||
new CustomerControllerProvider($isSsl), | ||
new CartControllerProvider($isSsl), | ||
new WishlistControllerProvider($isSsl), | ||
new HeartbeatControllerProvider($isSsl), | ||
new NewsletterControllerProvider($isSsl), | ||
new CatalogControllerProvider($isSsl), | ||
new CalculationControllerProvider($isSsl), | ||
new ProductSetControllerProvider($isSsl), | ||
new ProductSaleControllerProvider($isSsl), | ||
new ProductNewControllerProvider($isSsl), | ||
]; | ||
} | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
tests/PyzTest/Shared/Testify/_support/Helper/YvesBootstrap.php
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,56 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. | ||
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
*/ | ||
|
||
namespace PyzTest\Shared\Testify\Helper; | ||
|
||
use Codeception\Exception\ModuleConfigException; | ||
use Codeception\Lib\Framework; | ||
use Codeception\TestInterface; | ||
use PyzTest\Shared\Testify\Helper\Bootstrap\YvesBootstrap as ApplicationYvesBootstrap; | ||
use Symfony\Component\HttpKernel\Client; | ||
|
||
class YvesBootstrap extends Framework | ||
{ | ||
|
||
/** | ||
* @var \Spryker\Zed\Testify\Bootstrap\ZedBootstrap | ||
*/ | ||
private $application; | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function _initialize() | ||
{ | ||
$this->loadApplication(); | ||
} | ||
|
||
/** | ||
* @param \Codeception\TestInterface $test | ||
* | ||
* @return void | ||
*/ | ||
public function _before(TestInterface $test) | ||
{ | ||
$this->client = new Client($this->application->boot()); | ||
} | ||
|
||
/** | ||
* @throws \Codeception\Exception\ModuleConfigException | ||
* | ||
* @return void | ||
*/ | ||
protected function loadApplication() | ||
{ | ||
$this->application = new ApplicationYvesBootstrap(); | ||
|
||
if (!isset($this->application)) { | ||
throw new ModuleConfigException(__CLASS__, 'Application instance was not received from bootstrap file'); | ||
} | ||
} | ||
|
||
} |
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 +1 @@ | ||
[INFO - 2017-08-03T13:17:58.677Z] GhostDriver - Main - running on port 4444 | ||
[INFO - 2017-08-03T13:56:18.713Z] GhostDriver - Main - running on port 4444 |
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
Oops, something went wrong.