Ejemplo n.º 1
0
 /**
  * Base constructor.
  *
  * @param string $config Path to the MaxMind configuration.
  *
  * @throws \Webiny\Component\StdLib\Exception\Exception
  */
 public function __construct($config)
 {
     $config = \Webiny\Component\Config\Config::getInstance()->yaml($config);
     // bootstrap
     Mongo::setConfig(['Mongo' => $config->get('Mongo', null, true)]);
     Entity::setConfig(['Entity' => $config->get('Entity', null, true)]);
 }
Ejemplo n.º 2
0
 /**
  * Runs the installation.
  *
  * @throws \Webiny\Component\StdLib\Exception\Exception
  */
 public function runInstaller($configFile)
 {
     // bootstrap
     $this->config = Config::getInstance()->yaml($configFile);
     Mongo::setConfig(['Mongo' => $this->config->get('Mongo', null, true)]);
     Entity::setConfig(['Entity' => $this->config->get('Entity', null, true)]);
     /**
      * @var $mongo Mongo
      */
     $this->mongo = $this->mongo($this->config->Entity->Database);
     // import process
     $this->downloadDatabase();
     $this->unpackDatabase();
     $this->importLocations();
     //$this->importIp4CityBlock();
     //$this->importIp6CityBlock();
     echo "\nImport has finished.";
     die;
 }
Ejemplo n.º 3
0
 public static function setUpBeforeClass()
 {
     Mongo::setConfig(realpath(__DIR__ . '/' . self::MONGO_CONFIG));
     Entity::setConfig(realpath(__DIR__ . '/' . self::CONFIG));
     /**
      * Make sure no collections exist
      */
     self::mongo()->dropCollection('Author');
     self::mongo()->dropCollection('Page');
     self::mongo()->dropCollection('Comment');
     self::mongo()->dropCollection('Label');
     self::mongo()->dropCollection('Label2Page');
     /**
      * Create some test entity instances
      */
     $page = new Page();
     $author = new Author();
     $comment = new Comment();
     $label = new Label();
     $label2 = new Label();
     /**
      * Try simple assignment (should trigger assign via magic method)
      */
     $author->name = 'Pavel Denisjuk';
     /**
      * Assign using regular way
      */
     $comment->getAttribute('text')->setValue('Best blog post ever!');
     $label->getAttribute('label')->setValue('marketing');
     $label2->getAttribute('label')->setValue('seo');
     $page->getAttribute('title')->setValue('First blog post');
     $page->getAttribute('publishOn')->setValue('2014-11-01');
     $page->getAttribute('remindOn')->setValue(time());
     $page->getAttribute('author')->setValue($author);
     $page->getAttribute('settings')->setValue(['key1' => 'value1', 'key2' => ['key3' => 'value3']]);
     $page->getAttribute('comments')->add($comment);
     $page->getAttribute('labels')->add([$label, $label2]);
     self::$page = $page;
 }
Ejemplo n.º 4
0
 public function driverSet()
 {
     Mongo::setConfig(realpath(__DIR__ . '/' . self::CONFIG));
     return [[$this->mongo()]];
 }
Ejemplo n.º 5
0
 public function setUp()
 {
     \Webiny\Component\Mongo\Mongo::setConfig(new ConfigObject(['Driver' => 'Webiny\\AnalyticsDb\\Test\\MongoDriverMock']));
     $this->instance = new Query\Dimensions(new Mongo('localhost', 'testDb'), 'browser', 100, DateHelper::today());
 }
Ejemplo n.º 6
0
 public function setUp()
 {
     \Webiny\Component\Mongo\Mongo::setConfig(new ConfigObject(['Driver' => 'Webiny\\AnalyticsDb\\Test\\MongoDriverMock']));
     $this->instance = new AnalyticsDb(new Mongo('localhost', 'testDb'));
 }
Ejemplo n.º 7
0
<?php

require_once '../vendor/autoload.php';
\Webiny\Component\Security\Security::setConfig('./securityConfig.yaml');
\Webiny\Component\Mongo\Mongo::setConfig('./mongoConfig.yaml');
\Webiny\Component\Entity\Entity::setConfig('./entityConfig.yaml');
$security = \Webiny\Component\Security\Security::getInstance();
$loginConfig = \Webiny\Component\Config\Config::getInstance()->yaml('./loginConfig.yaml');
$login = new \Webiny\Login\Login($security, $loginConfig);
Ejemplo n.º 8
0
 public static function setUpBeforeClass()
 {
     Mongo::setConfig(realpath(__DIR__ . '/' . self::MONGO_CONFIG));
     Entity::setConfig(realpath(__DIR__ . '/' . self::CONFIG));
     self::deleteAllTestCollections();
 }
Ejemplo n.º 9
0
 public function setUp()
 {
     Mongo::setConfig(realpath(__DIR__ . '/' . self::CONFIG));
 }