/** * TYPO3 boot * * @param \Behat\Behat\Context\Context $context * @param \Behat\Behat\Hook\Scope\ScenarioScope $scope */ public function TYPO3Boot(&$context = NULL, &$scope = NULL) { if (!defined('ORIGINAL_ROOT')) { define('ORIGINAL_ROOT', strtr(getenv('TYPO3_PATH_WEB') ? getenv('TYPO3_PATH_WEB') . '/' : getcwd() . '/', '\\', '/')); } if (getenv('BEHAT_TYPO3_DOCROOT') && !defined('BEHAT_ROOT')) { define('BEHAT_ROOT', strtr(getenv('BEHAT_TYPO3_DOCROOT'), '\\', '/')); } $this->typo3BootstrapUtility = defined('BEHAT_ROOT') ? new Typo3BootstrapUtilityStatic() : new Typo3BootstrapUtilityDynamic(); $this->typo3InstancePath = $this->typo3BootstrapUtility->setUp($scope->getFeature()->getFile(), $this->typo3CoreExtensionsToLoad, $this->typo3TestExtensionsToLoad, $this->typo3PathsToLinkInTestInstance, $this->typo3ConfigurationToUseInTestInstance, $this->typo3AdditionalFoldersToCreate); // import db if (count($this->typo3DatabaseToImport) > 0) { foreach ($this->typo3DatabaseToImport as $path) { $this->importDataSet($path); } } // setup fe if (count($this->typo3FrontendRootPage) > 0) { $this->setupFrontendRootPage($this->typo3FrontendRootPage['pageId'], $this->typo3FrontendRootPage['typoscript'], $this->typo3FrontendRootPage['typoscriptConstants']); } // rewrite mink parameter $this->typo3BootstrapUtility->rewriteMinkParameter($context); // preparing object manager $this->typo3ObjectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); // preparing persistance manager $this->typo3PersistenceManager = $this->typo3ObjectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager'); }
/** * @param \Symfony\Component\DependencyInjection\ContainerInterface $container * @param \Doctrine\Common\Persistence\ManagerRegistry $doctrine * @param \Doctrine\Common\Persistence\ObjectManager $manager * @param \Behat\Behat\Hook\Scope\ScenarioScope $event * @param \Behat\Gherkin\Node\FeatureNode $feature * @param \Behat\Gherkin\Node\ScenarioNode $scenario * @param \Knp\FriendlyContexts\Alice\Loader\Yaml $loader * @param \Doctrine\Common\Persistence\Mapping\ClassMetadataFactory $metadataFactory * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $userMetadata * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $placeMetadata * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $productMetadata */ function let($container, $doctrine, $manager, $event, $loader, $feature, $scenario, $metadataFactory, $userMetadata, $placeMetadata, $productMetadata) { $doctrine->getManager()->willReturn($manager); $feature->getTags()->willReturn(['alice(Place)', 'admin']); $scenario->getTags()->willReturn(['alice(User)']); $event->getFeature()->willReturn($feature); $event->getScenario()->willReturn($scenario); $loader->load('user.yml')->willReturn([]); $loader->load('product.yml')->willReturn([]); $loader->load('place.yml')->willReturn([]); $loader->getCache()->willReturn([]); $loader->clearCache()->willReturn(null); $fixtures = ['User' => 'user.yml', 'Product' => 'product.yml', 'Place' => 'place.yml']; $config = ['alice' => ['fixtures' => $fixtures, 'dependencies' => []]]; $container->has(Argument::any())->willReturn(true); $container->hasParameter(Argument::any())->willReturn(true); $container->get('friendly.alice.loader.yaml')->willReturn($loader); $container->get('doctrine')->willReturn($doctrine); $container->getParameter('friendly.alice.fixtures')->willReturn($fixtures); $container->getParameter('friendly.alice.dependencies')->willReturn([]); $manager->getMetadataFactory()->willReturn($metadataFactory); $metadataFactory->getAllMetadata()->willReturn([$userMetadata, $placeMetadata, $productMetadata]); $userMetadata->getName()->willReturn('User'); $placeMetadata->getName()->willReturn('Place'); $productMetadata->getName()->willReturn('Product'); $this->initialize($config, $container); }
/** * @BeforeScenario * * @param ScenarioScope $scope */ public function initializeFeatureFilePath(ScenarioScope $scope) { $this->featurePath = dirname($scope->getFeature()->getFile()); }