protected function tearDown() { if (Files::exists($this->controllerPath)) { Files::delete($this->controllerPath); } parent::tearDown(); }
protected function tearDown() { Config::revertProperty("global", "prefix_system"); if (Files::exists($this->path)) { unlink($this->path); } parent::tearDown(); }
public function getControllerContents() { $controllerPath = $this->getControllerPath(); if (Files::exists($controllerPath)) { return file_get_contents($controllerPath); } return ''; }
public static function tearDownAfterClass() { Config::overrideProperty('debug')->with(true); Config::overrideProperty('language')->with('en'); Config::overridePropertyArray(array('global', 'prefix_system'), ''); if (Files::exists('/tmp/SampleConfigFile.php')) { unlink('/tmp/SampleConfigFile.php'); } }
private function _loadHelpers() { $viewHelperPath = Path::join('Helper', 'ViewHelper.php'); $appHelperPath = Path::join(ROOT_PATH, ApplicationPaths::getHelperPath(), 'ApplicationHelper.php'); $formHelperPath = Path::join('Helper', 'FormHelper.php'); $urlHelperPath = Path::join(ROOT_PATH, ApplicationPaths::getHelperPath(), 'UrlHelper.php'); $this->_requireOnce($viewHelperPath); Files::loadIfExists($appHelperPath); $this->_requireOnce($formHelperPath); Files::loadIfExists($urlHelperPath); }
public static function loadLabels() { if (!self::$_labels) { $language = self::getLanguage(); $path = Path::join(ROOT_PATH, 'locales', $language . '.php'); if (!Files::exists($path)) { throw new Exception('Cannot find declared language file: ' . $language); } /** @noinspection PhpIncludeInspection */ self::$_labels = (require $path); } return self::$_labels; }
/** * @return void */ private function includeRoutes() { $routesPath = Path::join(ROOT_PATH, 'config', 'routes.php'); Files::loadIfExists($routesPath); }
private function _loadViewHelper() { $helperPath = Path::join(ROOT_PATH, ApplicationPaths::getViewPath(), $this->_viewName . '.helper.php'); Files::loadIfExists($helperPath); }
public function isActionExists($actionFile) { return Files::exists(Path::join($this->getViewPath(), $actionFile)); }
<?php use Ouzo\Utilities\Clock; use Ouzo\Utilities\Files; use Ouzo\Utilities\Path; error_reporting(E_ALL); putenv('environment=test'); define('ROOT_PATH', realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR); require 'vendor/autoload.php'; Files::loadIfExists(Path::join(ROOT_PATH, 'config', 'error_codes.php')); Files::loadIfExists(Path::join(ROOT_PATH, 'config', 'routes.php')); Clock::freeze();
/** * @test */ public function shouldReturnFalseIfNotExistsAnTryToDelete() { //when $deleteIfExists = Files::deleteIfExists('/broken/path/file'); //then $this->assertFalse($deleteIfExists); }