private function init() { if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) { \PHPUnit_Framework_TestCase::markTestSkipped('This test requires SQLite support in your environment'); } $config = new \Doctrine\ORM\Configuration(); $config->setEntityNamespaces(array('UebbHateoasBundle' => 'uebb\\HateoasBundle\\Tests\\Entity')); $config->setAutoGenerateProxyClasses(true); $config->setProxyDir(\sys_get_temp_dir()); $config->setProxyNamespace('UebbHateoasTests\\Doctrine'); $reader = new AnnotationReader(); $metadataDriver = new AnnotationDriver($reader, 'uebb\\HateoasBundle\\Tests\\Entity'); $config->setMetadataDriverImpl($metadataDriver); $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $params = array('driver' => 'pdo_sqlite', 'memory' => true); $this->entityManager = EntityManager::create($params, $config); $this->linkParser = $this->getMock('uebb\\HateoasBundle\\Service\\LinkParserInterface'); $this->linkResolver = $this->getMock('uebb\\HateoasBundle\\Service\\LinkResolverInterface'); $this->dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'); $this->formResolver = new FormResolver($this->factory, $reader); $this->queryParser = $this->getMock('uebb\\HateoasBundle\\Service\\QueryParserInterface'); $this->serializer = $this->getMock('JMS\\Serializer\\SerializerInterface'); $this->validator = $this->getMock('Symfony\\Component\\Validator\\Validator\\ValidatorInterface'); $this->requestProcessor = new RequestProcessor($this->entityManager, $this->linkParser, $this->linkResolver, $this->formResolver, $this->dispatcher, $this->queryParser, $this->serializer, $this->validator); }
protected function loadConfig() { @(include $this->filename); if (!isset($GLOBALS['Blorgy_FunctionalTest_Config']) || !is_array($GLOBALS['Blorgy_FunctionalTest_Config'])) { $this->test->markTestSkipped('Functional test configuration is missing.'); } $config = $GLOBALS['Blorgy_FunctionalTest_Config']; if (!isset($config['working_dir']) || !isset($config['instance']) || !isset($config['base_href'])) { $this->test->markTestSkipped('Functional test configuration is missing or incorrect.'); } $this->instance = $config['instance']; if (strpos($config['base_href'], '%s') === false) { $this->base_href = $config['base_href']; } else { $this->base_href = sprintf($config['base_href'], $config['instance'], $config['working_dir']); } }
/** * Registers vfsStream * * @param PHPUnit_Framework_TestCase $testCase * * @return vfsStreamHelper_Wrapper */ public function __construct(PHPUnit_Framework_TestCase $testCase, $mountPoint = 'root') { @(include_once 'vfsStream/vfsStream.php'); if (!class_exists('vfsStreamWrapper')) { $testCase->markTestSkipped('vfsStream is not available - skipping'); } else { vfsStream::setup($mountPoint); } }
/** * Returns an entity manager for testing. * * @param Configuration|null $config * * @return EntityManager */ public static function createTestEntityManager(Configuration $config = null) { if (!extension_loaded('pdo_sqlite')) { \PHPUnit_Framework_TestCase::markTestSkipped('Extension pdo_sqlite is required.'); } if (null === $config) { $config = self::createTestConfiguration(); } $params = array('driver' => 'pdo_sqlite', 'memory' => true); return EntityManager::create($params, $config); }
/** * Returns an entity manager for testing. * * @return EntityManager */ public static function createTestEntityManager() { if (!extension_loaded('pdo_sqlite')) { \PHPUnit_Framework_TestCase::markTestSkipped('Extension pdo_sqlite is required.'); } $config = new \Doctrine\ORM\Configuration(); $config->setEntityNamespaces(array('SymfonyTestsDoctrine' => 'Symfony\\Bridge\\Doctrine\\Tests\\Fixtures')); $config->setAutoGenerateProxyClasses(true); $config->setProxyDir(\sys_get_temp_dir()); $config->setProxyNamespace('SymfonyTests\\Doctrine'); $config->setMetadataDriverImpl(new AnnotationDriver(new AnnotationReader())); $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $params = array('driver' => 'pdo_sqlite', 'memory' => true); return EntityManager::create($params, $config); }
/** * Returns an entity manager for testing. * * @return EntityManager */ public static function createTestEntityManager() { if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) { \PHPUnit_Framework_TestCase::markTestSkipped('This test requires SQLite support in your environment'); } $config = new \Doctrine\ORM\Configuration(); $config->setEntityNamespaces(array('SymfonyTestsDoctrine' => 'Symfony\\Bridge\\Doctrine\\Tests\\Fixtures')); $config->setAutoGenerateProxyClasses(true); $config->setProxyDir(\sys_get_temp_dir()); $config->setProxyNamespace('SymfonyTests\\Doctrine'); $config->setMetadataDriverImpl(new AnnotationDriver(new AnnotationReader())); $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $params = array('driver' => 'pdo_sqlite', 'memory' => true); return EntityManager::create($params, $config); }
/** * Analyze results of aggregated tests execution and complete test case appropriately * * @param array $results * @param int $passed * @return void */ protected function processResults(array $results, $passed) { $totalCountsMessage = sprintf('Passed: %d, Failed: %d, Incomplete: %d, Skipped: %d.', $passed, count($results['PHPUnit_Framework_AssertionFailedError']), count($results['PHPUnit_Framework_IncompleteTestError']), count($results['PHPUnit_Framework_SkippedTestError'])); if ($results['PHPUnit_Framework_AssertionFailedError']) { $this->_testCase->fail($totalCountsMessage . PHP_EOL . implode(PHP_EOL, $results['PHPUnit_Framework_AssertionFailedError'])); } if (!$results['PHPUnit_Framework_IncompleteTestError'] && !$results['PHPUnit_Framework_SkippedTestError']) { return; } $message = $totalCountsMessage . PHP_EOL . implode(PHP_EOL, $results['PHPUnit_Framework_IncompleteTestError']) . PHP_EOL . implode(PHP_EOL, $results['PHPUnit_Framework_SkippedTestError']); if ($results['PHPUnit_Framework_IncompleteTestError']) { $this->_testCase->markTestIncomplete($message); } elseif ($results['PHPUnit_Framework_SkippedTestError']) { $this->_testCase->markTestSkipped($message); } }
protected function loadConfig() { @(include $this->filename); if (!isset($GLOBALS['FunctionalTest_Config']) || !is_array($GLOBALS['FunctionalTest_Config'])) { $this->test->markTestSkipped('Functional test configuration is missing.'); } $config = $GLOBALS['FunctionalTest_Config']; if (!isset($config['working_dir']) || !isset($config['base_href'])) { $this->test->markTestSkipped('Functional test configuration is missing or incorrect.'); } if (isset($config['instance'])) { $this->instance = $config['instance']; } if (isset($config['domain'])) { $this->domain = $config['domain']; } if (strpos($config['base_href'], '%s') === false) { $this->base_href = $config['base_href']; } elseif ($this->instance == '') { $this->base_href = sprintf($config['base_href'], $config['working_dir']); } else { $this->base_href = sprintf($config['base_href'], $this->instance, $config['working_dir']); } if (isset($config['screenshot_path'])) { $this->screenshot_path = $config['screenshot_path']; } if (isset($config['screenshot_url'])) { $this->screenshot_url = $config['screenshot_url']; } if (isset($config['selenium_host'])) { $this->selenium_host = $config['selenium_host']; } if (isset($config['selenium_port'])) { $this->selenium_port = (int) $config['selenium_port']; } }
/** * http://www.phpunit.de/manual/current/en/incomplete-and-skipped-tests.html * * @see lime_test#skip() * * @param string $message * @param int $nb_tests */ public function skip($message = '', $nb_tests = 1) { $this->testCase->markTestSkipped($message . ($message ? ', ' : '') . 'nb_tests: ' . $nb_tests); }
/** * Skips the test unless the current system has a 64bit architecture. */ public static function require64Bit(\PHPUnit_Framework_TestCase $testCase) { if (8 !== PHP_INT_SIZE) { $testCase->markTestSkipped('PHP 64 bit is required.'); } }
/** * Mark this test as skipped. Puts extra information in the logs. * * @param string $message */ public static function markTestSkipped($message = '') { $backtrace = wfDebugBacktrace(3); $entry = $backtrace[1]; Wikia::log(wfFormatStackFrame($entry), false, "marked as skipped - {$message}"); parent::markTestSkipped($message); }
public static function markTestSkipped($message = '') { Wikia::log(__METHOD__, '', $message); parent::markTestSkipped($message); }
/** * */ public static function requiredBy(PHPUnit_Framework_TestCase $Case) { if (!Runkit::isEnabled()) { $Case->markTestSkipped('Runkit must be enabled'); } }
/** * Profiles the callback and test the result against the given configuration. */ public function assertPhpUnit(\PHPUnit_Framework_TestCase $testCase, Profile\Configuration $config, $callback) { if (!$config->hasMetadata('skip_timeline')) { $config->setMetadata('skip_timeline', 'true'); } try { $probe = $this->createProbe($config); $callback(); $profile = $this->endProbe($probe); $testCase->assertThat($profile, new BlackfireConstraint()); } catch (Exception\ExceptionInterface $e) { $testCase->markTestSkipped($e->getMessage()); } return $profile; }