コード例 #1
0
 public function compile()
 {
     foreach (PluginRepository::findAll() as $plugin) {
         $containerBuilder = new UnfreezableContainerBuilder();
         $containerBuilder->registerExtension(new GeneralExtension());
         $extensionClass = new \ReflectionClass('Stagehand\\TestRunner\\DependencyInjection\\Extension\\' . $plugin->getPluginID() . 'Extension');
         if (!$extensionClass->isInterface() && !$extensionClass->isAbstract() && $extensionClass->isSubclassOf('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')) {
             $containerBuilder->registerExtension($extensionClass->newInstance());
         }
         foreach ($containerBuilder->getExtensions() as $extension) {
             /* @var $extension \Symfony\Component\DependencyInjection\Extension\ExtensionInterface */
             $containerBuilder->loadFromExtension($extension->getAlias(), array());
         }
         $containerBuilder->addCompilerPass(new ReplaceDefinitionByPluginDefinitionPass($plugin));
         $containerBuilder->getCompilerPassConfig()->setOptimizationPasses(array_filter($containerBuilder->getCompilerPassConfig()->getOptimizationPasses(), function (CompilerPassInterface $compilerPass) {
             return !$compilerPass instanceof ResolveParameterPlaceHoldersPass;
         }));
         ErrorReporting::invokeWith(error_reporting() & ~E_USER_DEPRECATED, function () use($containerBuilder) {
             $containerBuilder->compile();
         });
         $phpDumper = new PhpDumper($containerBuilder);
         $containerClass = $plugin->getPluginID() . 'Container';
         $containerClassSource = $phpDumper->dump(array('class' => $containerClass));
         $containerClassSource = preg_replace('/^<\\?php/', '<?php' . PHP_EOL . 'namespace ' . self::COMPILED_CONTAINER_NAMESPACE . ';' . PHP_EOL, $containerClassSource);
         file_put_contents(__DIR__ . '/../' . $containerClass . '.php', $containerClassSource);
     }
 }
コード例 #2
0
 public function clearOutputHandlers()
 {
     $self = $this;
     ErrorReporting::invokeWith(E_NOTICE, function () use($self) {
         while ($self->getNestingLevel()) {
             $self->clearOutputHandler();
         }
     });
 }
コード例 #3
0
 public function prepare()
 {
     parent::prepare();
     if (is_null($this->getCIUnitPath())) {
         $ciunitPath = ApplicationContext::getInstance()->getEnvironment()->getWorkingDirectoryAtStartup();
     } else {
         $ciunitPath = $this->getCIUnitPath();
     }
     /* Removes some superglobals and environment variables to avoid getting invalid
      * URI string by the CIUnit URI object since some cases PDT sets some
      * environment variables for debugging.
      */
     $this->backupVariables();
     ErrorReporting::invokeWith(error_reporting() & ~E_USER_NOTICE, function () use($ciunitPath) {
         require_once $ciunitPath . '/CIUnit.php';
     });
     $this->restoreVariables();
 }
コード例 #4
0
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * @copyright  2009-2012, 2014-2015 KUBO Atsuhiro <*****@*****.**>
 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License
 *
 * @version    Release: @package_version@
 *
 * @since      File available since Release 2.10.0
 */
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../bootstrap.php';
\Phake::setClient(\Phake::CLIENT_PHPUNIT);
\Stagehand\TestRunner\Util\ErrorReporting::enableErrorToException();
define('PHPUNIT_TESTSUITE', true);
/*
 * Local Variables:
 * mode: php
 * coding: iso-8859-1
 * tab-width: 4
 * c-basic-offset: 4
 * c-hanging-comment-ender-p: nil
 * indent-tabs-mode: nil
 * End:
 */
コード例 #5
0
 public function prepare()
 {
     if (defined('STAGEHAND_TESTRUNNER_PREPARER_CAKEPREPARER_PREPARECALLEDMARKER')) {
         return;
     }
     define('STAGEHAND_TESTRUNNER_PREPARER_CAKEPREPARER_PREPARECALLEDMARKER', true);
     if (!defined('DISABLE_AUTO_DISPATCH')) {
         define('DISABLE_AUTO_DISPATCH', true);
     }
     if (is_null($this->getCakePHPAppPath())) {
         $cakephpAppPath = $this->environment->getWorkingDirectoryAtStartup();
     } else {
         $cakephpAppPath = $this->getCakePHPAppPath();
     }
     $rootPath = realpath($cakephpAppPath . '/..');
     $appPath = basename(realpath($cakephpAppPath));
     if (is_null($this->getCakePHPCorePath())) {
         $corePath = $rootPath . DIRECTORY_SEPARATOR . 'cake';
     } else {
         $corePath = realpath($this->getCakePHPCorePath());
     }
     if (!defined('TEST_CAKE_CORE_INCLUDE_PATH')) {
         define('TEST_CAKE_CORE_INCLUDE_PATH', rtrim($corePath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR);
     }
     ob_start();
     require_once $corePath . '/console/cake.php';
     ErrorReporting::invokeWith(error_reporting(), function () use($rootPath, $appPath) {
         new TestRunnerShellDispatcher(array('-root', $rootPath, '-app', $appPath));
     });
     ob_end_clean();
     require_once $corePath . '/tests/lib/test_manager.php';
     new \TestManager();
 }