Beispiel #1
0
 public function testNestedGet()
 {
     $config = new Config(self::ROOT);
     $this->assertTrue($config->cacheSet());
     $dsn = $config->get('db.dsn');
     $this->assertTrue('q' === $dsn);
 }
 public function setup()
 {
     $root = __DIR__ . '/../public';
     $config = new Config($root);
     $config->cacheSet();
     $this->container = Container::instance($root, $config, $root . '/../config/containers/test-container.yml');
 }
Beispiel #3
0
 public function setup()
 {
     date_default_timezone_set('UTC');
     $root = __DIR__ . '/../public';
     $config = new Config($root);
     $config->cacheSet();
     $this->container = Container::instance($root, $config, $root . '/../config/containers/test-container.yml');
     $this->search = $this->container->get('search');
 }
Beispiel #4
0
 public function setup()
 {
     $root = __DIR__ . '/../public';
     $testContainer = $root . '/../config/containers/test-container.yml';
     $config = new Config($root);
     $config->cacheSet();
     $container = Container::instance($root, $config, $testContainer);
     $this->model = $container->get('bundleModel');
 }
 public static function setUpBeforeClass()
 {
     $root = __DIR__ . '/../public';
     $config = new Config($root);
     $config->cacheSet();
     $container = Container::instance($root, $config, $root . '/../config/containers/test-container.yml');
     $db = $container->get('db');
     $dbURI = 'blogs:54750ca92798718d438b45a7';
     $db->document($dbURI, ['author' => '', 'body' => '', 'categories' => ['547f377827987110048b4579'], 'code_name' => 'test-post', 'comments' => 'f', 'date_published' => null, 'description' => 'this is the summary', 'display_date' => new MongoDate(strtotime('2014-12-01T00:00:00Z')), 'featured' => 'f', 'metadata_description' => '', 'metadata_keywords' => '', 'pinned' => 'f', 'publication_name' => '', 'status' => 'published', 'title' => 'Test Post 2', 'tags' => ['test']])->upsert();
 }
Beispiel #6
0
 public function setup()
 {
     $root = __DIR__ . '/../public';
     $config = new Config($root);
     $config->cacheSet();
     $container = Container::instance($root, $config, $root . '/../config/containers/test-container.yml');
     $this->db = $container->get('db');
     $this->ensureDocuments();
     $this->helperRoute = $container->get('helperRoute');
 }
Beispiel #7
0
 public function setup()
 {
     $root = __DIR__ . '/../public';
     $config = new Config($root);
     $config->cacheSet();
     $container = Container::instance($root, $config, $root . '/../config/containers/test-container.yml');
     $this->route = $container->get('route');
     $this->managerRoute = $container->get('managerRoute');
     $this->managerModel = $container->get('managerModel');
     $this->route->testMode();
     $this->managerRoute->paths();
 }
Beispiel #8
0
 public function setup()
 {
     $root = __DIR__ . '/../public';
     $config = new Config($root);
     $config->cacheSet();
     $this->container = Container::instance($root, $config, $root . '/../config/containers/test-container.yml');
     $model = $this->container->get('pubSubModel');
     $model->build();
     $this->topic = $this->container->get('topic');
     $cache = $model->readDiskCache();
     $this->topic->cacheSet($cache);
 }
Beispiel #9
0
 public function setup()
 {
     $this->root = __DIR__ . '/../public';
     $config = new Config($this->root);
     $config->cacheSet();
     $container = Container::instance($this->root, $config, $this->root . '/../config/containers/test-container.yml');
     $this->db = $container->get('db');
     $this->formRoute = $container->get('formRoute');
     $this->formController = $container->get('formController');
     $this->formModel = $container->get('formModel');
     $this->formView = $container->get('formView');
     $this->form = $container->get('form');
     $this->post = $container->get('post');
     $this->topic = $container->get('topic');
     $this->route = $container->get('route');
     $this->route->testMode();
     $this->ensureDocuments();
     $this->post->clear();
     $this->formRoute->paths();
 }
Beispiel #10
0
 public function run()
 {
     if (!isset($_SERVER['argv'][1])) {
         die('no command supplied');
     }
     if (empty(getenv('OPINE_ENV'))) {
         die('OPINE_ENV should be set on command line, even if only to: defualt');
     }
     $root = $this->root();
     $config = new Config($root);
     $config->cacheSet();
     $container = Container::instance($root, $config, $root . '/../config/containers/container.yml');
     $this->routing($container);
     switch ($_SERVER['argv'][1]) {
         case 'help':
             echo 'The available commands are:', "\n", 'build', "\n", 'check', "\n", 'collection-counts-refresh', "\n", 'container-build', "\n", 'database-create-indexes', "\n", 'database-migrate-dburi', "\n", 'queue-peek', "\n", 'search-reindex [collection]', "\n", 'search-index-drop', "\n", 'topics-show', "\n", 'version', "\n", 'worker', "\n";
             break;
         case 'manager-install':
             if (!isset($_SERVER['argv'][2])) {
                 return;
             }
             $container->get('build')->managerInstall($_SERVER['argv'][2]);
             break;
         case 'collection-install':
             if (!isset($_SERVER['argv'][2])) {
                 return;
             }
             $container->get('build')->collectionInstall($_SERVER['argv'][2]);
             break;
         case 'build':
             $container->get('build')->project($root);
             break;
         case 'queue-peek':
             $container->get('queue')->peekReady();
             break;
         case 'worker':
             set_time_limit(0);
             $container->get('worker')->work();
             break;
         case 'check':
             $container->get('build')->environmentCheck($root);
             break;
         case 'database-migrate-dburi':
             $container->get('dbmigration')->addURI();
             break;
         case 'database-create-indexes':
             $container->get('collectionModel')->reIndexDataAll();
             break;
         case 'search-reindex':
             if (isset($_SERVER['argv'][2])) {
                 $container->get('collectionModel')->reIndexSearch($_SERVER['argv'][2]);
             } else {
                 $container->get('collectionModel')->reIndexSearchAll();
             }
             break;
         case 'search-index-drop':
             $container->get('search')->indexDrop();
             break;
         case 'topics-show':
             $container->get('topic')->show();
             break;
         case 'collection-counts-refresh':
             $container->get('collectionModel')->statsAll();
             break;
         case 'container-build':
             $container->get('build')->container($root);
             break;
         case 'version':
             echo file_get_contents($root . '/../vendor/opine/framework/version.txt'), "\n";
             break;
         default:
             echo 'Unknown command', "\n";
             break;
     }
 }
Beispiel #11
0
 public function __construct($noContainerCache = false)
 {
     $this->root = $this->root();
     $cache = new Cache($this->root);
     $this->environment();
     $this->errors();
     $this->apiToken = $this->apiTokenFromRequest();
     $items = ['collections', 'forms', 'bundles', 'topics', 'routes', 'container', 'languages', 'config'];
     $person = false;
     if (!empty($this->apiToken)) {
         $person = json_decode($cache->get('person-' . $this->apiToken), true);
     }
     $cacheResult = json_decode($cache->get($this->cachePrefix . '-opine'), true);
     $containerCache = [];
     if ($noContainerCache === false && isset($cacheResult['container'])) {
         $containerCache = $cacheResult['container'];
     }
     if ($cacheResult['routes'] != false) {
         $this->routeCached = true;
     }
     $config = new Config($this->root);
     if ($cacheResult['config'] !== false) {
         $configData = $cacheResult['config'];
         if (isset($configData[$this->environment])) {
             $config->cacheSet($configData[$this->environment]);
         } elseif (isset($configData['default'])) {
             $config->cacheSet($configData['default']);
         }
     } else {
         $config->cacheSet();
     }
     $this->container = Container::instance($this->root, $config, $this->root . '/../config/containers/container.yml', $noContainerCache, $containerCache);
     $this->container->set('cache', $cache);
     $this->cache($cacheResult, $person);
 }
Beispiel #12
0
 public function __construct($noContainerCache = false)
 {
     $this->environment();
     $this->errors();
     $this->root = $this->root();
     $this->apiToken = $this->apiTokenFromRequest();
     $items = [$this->root . '-collections' => false, $this->root . '-forms' => false, $this->root . '-bundles' => false, $this->root . '-topics' => false, $this->root . '-routes' => false, $this->root . '-container' => false, $this->root . '-languages' => false, $this->root . '-config' => false];
     if (!empty($this->apiToken)) {
         $items['person-' . $this->apiToken] = false;
     }
     $cache = new Cache();
     $cacheResult = $cache->getBatch($items);
     $containerCache = [];
     if ($noContainerCache === false && isset($items[$this->root . '-container'])) {
         $containerCache = json_decode($items[$this->root . '-container'], true);
     }
     if ($items[$this->root . '-routes'] != false) {
         $this->routeCached = true;
     }
     $config = new Config($this->root);
     if ($items[$this->root . '-config'] !== false) {
         $configData = json_decode($items[$this->root . '-config'], true);
         if (isset($configData[$this->environment])) {
             $config->cacheSet($configData[$this->environment]);
         } elseif (isset($configData['default'])) {
             $config->cacheSet($configData['default']);
         }
     } else {
         $config->cacheSet();
     }
     $this->container = Container::instance($this->root, $config, $this->root . '/../config/containers/container.yml', $noContainerCache, $containerCache);
     $this->container->set('cache', $cache);
     $this->cache($items);
 }