Exemplo n.º 1
0
 protected function tearDown()
 {
     if (Files::exists($this->controllerPath)) {
         Files::delete($this->controllerPath);
     }
     parent::tearDown();
 }
Exemplo n.º 2
0
 protected function tearDown()
 {
     Config::revertProperty("global", "prefix_system");
     if (Files::exists($this->path)) {
         unlink($this->path);
     }
     parent::tearDown();
 }
Exemplo n.º 3
0
 public function getControllerContents()
 {
     $controllerPath = $this->getControllerPath();
     if (Files::exists($controllerPath)) {
         return file_get_contents($controllerPath);
     }
     return '';
 }
Exemplo n.º 4
0
 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');
     }
 }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
 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;
 }
Exemplo n.º 7
0
 /**
  * @return void
  */
 private function includeRoutes()
 {
     $routesPath = Path::join(ROOT_PATH, 'config', 'routes.php');
     Files::loadIfExists($routesPath);
 }
Exemplo n.º 8
0
 private function _loadViewHelper()
 {
     $helperPath = Path::join(ROOT_PATH, ApplicationPaths::getViewPath(), $this->_viewName . '.helper.php');
     Files::loadIfExists($helperPath);
 }
Exemplo n.º 9
0
 public function isActionExists($actionFile)
 {
     return Files::exists(Path::join($this->getViewPath(), $actionFile));
 }
Exemplo n.º 10
0
<?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();
Exemplo n.º 11
0
 /**
  * @test
  */
 public function shouldReturnFalseIfNotExistsAnTryToDelete()
 {
     //when
     $deleteIfExists = Files::deleteIfExists('/broken/path/file');
     //then
     $this->assertFalse($deleteIfExists);
 }