Example #1
0
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     Config::getInstance()->set(array('resource.log.' . self::SYSLOG_CONNECTION_CONFIG_NAME . '.facility' => LOG_LOCAL5, 'resource.log.' . self::SYSLOG_CONNECTION_CONFIG_NAME . '.applicationIdent' => self::SYSLOG_CONNECTION_APPLICATION_INDENT, 'resource.log.' . self::SYSLOG_CONNECTION_CONFIG_NAME . '.includeSapiName' => false, 'resource.log.' . self::SYSLOG_CONNECTION_CONFIG_NAME . '.addPid' => false));
     $this->syslogConnectionMock = new SyslogConnectionMock();
     $this->syslogLogger = new SyslogLoggerMock(self::SYSLOG_CONNECTION_CONFIG_NAME, $this->syslogConnectionMock);
 }
Example #2
0
 /**
  * @see PHPUnit_Framework_TestCase::setUp()
  */
 protected function setUp()
 {
     parent::setUp();
     $this->originalObLevel = ob_get_level();
     $this->output = new OutputMock();
     $this->createCleanResponse();
 }
 protected function setUp()
 {
     parent::setUp();
     // TODO Make this setting global. For this, there should be a base class for all tests [szeber]
     Config::getInstance()->set('system.project.name', 'test');
     $this->originalObLevel = ob_get_level();
 }
Example #4
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->previousApplication = \YapepBase\Application::getInstance();
     $this->object = new Mock\ApplicationMock();
     Application::setInstance($this->object);
 }
 public function setUp()
 {
     parent::setUp();
     $this->errorReportingLevel = error_reporting();
     error_reporting(E_ALL);
     Config::getInstance()->set('system.errorHandling.defaultIdTimeout', 0);
 }
Example #6
0
 protected function setUp()
 {
     parent::setUp();
     Application::getInstance()->setI18nTranslator(new TranslatorMock(function ($string, $params) {
         return json_encode(array('string' => $string, 'params' => $params));
     }));
 }
Example #7
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     $this->fileHandler = new FileHandlerPhp();
     vfsStreamWrapper::register();
     try {
         $testPath = $this->getTestPath();
         // Remove the files
         foreach ($this->resourcesToRemove as $path) {
             $fullPath = $testPath . $path;
             if (is_file($fullPath)) {
                 unlink($fullPath);
             }
         }
         // Remove the directories
         foreach ($this->resourcesToRemove as $path) {
             $fullPath = $testPath . $path;
             if (is_dir($fullPath)) {
                 rmdir($fullPath);
             }
         }
     } catch (\PHPUnit_Framework_SkippedTestError $e) {
     } catch (\PHPUnit_Framework_AssertionFailedError $e) {
     }
 }
 public function setUp()
 {
     parent::setUp();
     $this->storage = new StorageMock(false, true);
     $this->errorHandler = new DebugDataCreator($this->storage, true);
     $_GET = array('test' => 'getTest');
     $_POST = array('test' => 'postTest');
     $_COOKIE = array('test' => 'cookieTest');
     $_ENV = array('test' => 'envTest');
 }
Example #9
0
 /**
  * Runs before each test
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     $this->originalDiContainer = Application::getInstance()->getDiContainer();
     $diContainer = new SystemContainer();
     $this->storage = new StorageMock(true, false, array());
     $diContainer->setMiddlewareStorage($this->storage);
     Application::getInstance()->setDiContainer($diContainer);
     Config::getInstance()->set(array('system.project.name' => 'test'));
 }
Example #10
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
     $container = new SystemContainer();
     $container[SystemContainer::KEY_MEMCACHE] = $container->share(function ($container) {
         return new MemcacheMock();
     });
     Application::getInstance()->setDiContainer($container);
     $this->memcacheMock = Application::getInstance()->getDiContainer()->getMemcache();
     Config::getInstance()->set(array('resource.storage.test.host' => 'localhost', 'resource.storage.test.readOnly' => false, 'resource.storage.test2.host' => 'localhost', 'resource.storage.test2.port' => 11222, 'resource.storage.test2.keyPrefix' => 'test.', 'resource.storage.test2.keySuffix' => '.test', 'resource.storage.test3.host' => 'localhost', 'resource.storage.test3.hashKey' => true, 'resource.storage.test3.keyPrefix' => 'test.', 'resource.storage.test4.port' => 11211, 'resource.storage.test5.host' => 'localhost', 'resource.storage.test5.readOnly' => true));
 }
 protected function setUp()
 {
     parent::setUp();
     $this->originalObLevel = ob_get_level();
     $application = Application::getInstance();
     $this->originalDiContainer = $application->getDiContainer();
     $diContainer = new SystemContainer();
     $diContainer->addSearchNamespace(SystemContainer::NAMESPACE_SEARCH_CONTROLLER, '\\YapepBaseTest\\Mock\\Controller');
     $application->setDiContainer($diContainer);
     $application->setI18nTranslator(new TranslatorMock(function ($string, $params) {
         return json_encode(array('string' => $string, 'params' => $params));
     }));
 }
 /**
  * Prepares the environment before running a test.
  *
  * We are using '_' as the param prefix.
  */
 protected function setUp()
 {
     parent::setUp();
     if (!\function_exists('\\pdo_drivers')) {
         $this->markTestSkipped('PDO is not available');
     } else {
         $driverlist = \pdo_drivers();
         if (!\array_search('sqlite', $driverlist)) {
             $this->markTestSkipped('PDO SQLite driver is not available');
         }
     }
     $this->subject = new SqliteConnection(array('path' => ':memory:'), 'test', '_');
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
     $directoryName = 'test';
     $filename = 'test.txt';
     $this->fileContent = 'test' . PHP_EOL . 'test' . PHP_EOL . 'test' . PHP_EOL . 'test';
     vfsStreamWrapper::register();
     $directory = new vfsStreamDirectory($directoryName);
     $file = new vfsStreamFile($filename);
     $file->setContent($this->fileContent);
     $directory->addChild($file);
     vfsStreamWrapper::setRoot($directory);
     $this->filePath = vfsStream::url($directoryName . DIRECTORY_SEPARATOR . $filename);
 }
Example #14
0
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     $this->originalDiContainer = Application::getInstance()->getDiContainer();
     $diContainer = new SystemContainer();
     $this->errorHandler = new ErrorHandlerMock();
     $this->eventHandler = new EventHandlerMock();
     $errorHandlerRegistry = new \YapepBase\ErrorHandler\ErrorHandlerRegistry();
     $errorHandlerRegistry->addErrorHandler($this->errorHandler);
     $eventHandlerRegistry = new \YapepBase\Event\EventHandlerRegistry();
     $eventHandlerRegistry->registerEventHandler(Event::TYPE_APPLICATION_BEFORE_RUN, $this->eventHandler);
     $eventHandlerRegistry->registerEventHandler(Event::TYPE_APPLICATION_AFTER_RUN, $this->eventHandler);
     $diContainer[SystemContainer::KEY_ERROR_HANDLER_REGISTRY] = $errorHandlerRegistry;
     $diContainer[SystemContainer::KEY_EVENT_HANDLER_REGISTRY] = $eventHandlerRegistry;
     Application::getInstance()->setDiContainer($diContainer);
 }
Example #15
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     clearstatcache();
     $this->testBasePath = rtrim(getenv('YAPEPBASE_TEST_TEMPPATH'), DIRECTORY_SEPARATOR);
     if (empty($this->testBasePath)) {
         $this->markTestSkipped('Test cannot be done without a test directory');
     } else {
         $this->testBasePath .= DIRECTORY_SEPARATOR;
     }
     if (stripos(PHP_OS, 'WIN') === 0) {
         $this->markTestSkipped('The Unix file handler tests can not be run on Windows');
     }
     if (!file_exists($this->testBasePath) && !mkdir($this->testBasePath, 0755, true)) {
         $this->markTestSkipped('The given path does not exist, and cannot be created: ' . $this->testBasePath);
     }
     $this->cleanupTestDirectory();
     $this->fileHandler = new FileHandlerUnix();
 }
Example #16
0
    /**
     * Prepares the environment before running a test.
     *
     * We are using '_' as the param prefix.
     */
    protected function setUp()
    {
        parent::setUp();
        if (!$this->isRunnable) {
            $this->markTestSkipped('Required ENV variables missing');
            return;
        }
        $this->connection = $this->getConnection();
        $this->connection->query('DROP TABLE IF EXISTS test');
        $this->connection->query('DROP TABLE IF EXISTS test2');
        $createTestTable = '
			CREATE TABLE test (
				id          BIGINT(20)   UNSIGNED NOT NULL AUTO_INCREMENT,
				`key`       VARCHAR(255)          NOT NULL,
				`value`     VARCHAR(255)          NOT NULL,
				PRIMARY KEY (id),
				UNIQUE KEY idx_unique_key(`key`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		';
        $this->connection->query($createTestTable);
    }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     $this->commandOutputHelper = new CommandOutputHelper();
 }
 protected function setUp()
 {
     parent::setUp();
     $this->simpleAutoloader = new SimpleAutoloaderMock();
 }
 /**
  * Sets up the testing environment for every test.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->originalErrorReporting = error_reporting(E_ALL | E_STRICT);
 }
 /**
  * Runs before each test
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     $this->mockValidator = new MockValidator();
 }
 public function setUp()
 {
     parent::setUp();
     $this->object = new SyslogConnectionMock();
 }
Example #22
0
 protected function setUp()
 {
     parent::setUp();
     $this->originalObLevel = ob_get_level();
 }
 public function setUp()
 {
     parent::setUp();
     $this->logger = new LoggerMock();
     $this->errorHandler = new LoggingErrorHandler($this->logger);
 }
Example #24
0
 /**
  * Prepares the environment before running a test.
  */
 protected function setUp()
 {
     parent::setUp();
 }
Example #25
0
 /**
  * Prepares the environment before running a test.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->config = Config::getInstance();
     $this->config->set(array('resource.database.test.rw.backendType' => DbFactory::BACKEND_TYPE_SQLITE, 'resource.database.test.rw.path' => ':memory:'));
 }
Example #26
0
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     Config::getInstance()->set(array('resource.session.test.namespace' => 'test', 'resource.session.test.cookieName' => 'testSession', 'resource.session.test.cookieDomain' => 'testdomain', 'resource.session.test.cookiePath' => '/test', 'resource.missingNamespace.cookieName' => 'testSession'));
 }
Example #27
0
 /**
  * Prepares the environment before running a test.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->request = $this->getRequest();
 }
Example #28
0
 /**
  * Runs before each test
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     $this->viewMock = new ViewMock();
 }
 public function setUp()
 {
     parent::setUp();
     $this->autoloaderRegistry = new AutoloaderRegistryMock();
 }
Example #30
0
 public function setUp()
 {
     parent::setUp();
     $this->object = new \YapepBase\Util\CsvParser();
 }