/**
  * 
  */
 public function setUp()
 {
     $this->setApplicationConfig(include __DIR__ . '/../../../config/test/application.config.php');
     $oServiceManager = \ApplicationTest\Bootstrap::getServiceManager();
     $this->oDao = $oServiceManager->get('DocumentTable');
     parent::setUp();
 }
 /**
  * 
  */
 public function setUp()
 {
     $this->setApplicationConfig(include __DIR__ . '/../../../config/test/application.config.php');
     $oServiceManager = \ApplicationTest\Bootstrap::getServiceManager();
     $this->oEm = $oServiceManager->get('Doctrine\\ORM\\EntityManager');
     parent::setUp();
 }
Example #3
0
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->setApplicationConfig($this->serviceManager->get('ApplicationConfig'));
     $this->calc = new Stdlib\Calc();
     parent::setUp();
 }
 /**
  * 
  */
 public function setUp()
 {
     $this->setApplicationConfig(include __DIR__ . '/../../../config/test/application.config.php');
     $oServiceManager = \ApplicationTest\Bootstrap::getServiceManager();
     $COOKIE[DocumentTracker::COOKIE_NAME] = array();
     $this->object = $oServiceManager->get('DocumentTracker');
     parent::setUp();
 }
Example #5
0
 public function getCategoryService()
 {
     if ($this->categoryService) {
         return $this->categoryService;
     }
     $serviceManager = Bootstrap::getServiceManager();
     $this->categoryService = $serviceManager->get('categoryfactory');
     return $this->categoryService;
 }
Example #6
0
 public function testCategories()
 {
     $serviceManager = Bootstrap::getServiceManager();
     $module = new \MainMenu\Module();
     $categories = $module->getTopCategories($serviceManager);
     $this->assertInternalType('array', $categories);
     foreach ($categories as $category) {
         $this->assertInternalType('array', $category['listings']);
     }
 }
 protected function setUp()
 {
     $this->controller = new ConfigurationRestController();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'rest_configuration'));
     $this->event = new MvcEvent();
     $config = Bootstrap::getServiceManager()->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator(Bootstrap::getServiceManager());
 }
Example #8
0
 public function testInvalidAuth()
 {
     $this->getRequest()->setMethod('GET');
     $this->dispatch('/n/add');
     $this->assertResponseStatusCode(302);
     $auth = Bootstrap::getServiceManager()->get('Whathood\\Model\\AuthenticationService');
     $auth->setWhathoodUser(new \Whathood\Entity\WhathoodUser(array('id' => 1)));
     try {
         $this->dispatch('/n/add');
         //die( $this->getResponse()->getBody() );
         $this->fail();
     } catch (AuthenticationException $e) {
     } catch (\FacebookApiException $e) {
     }
     $this->assertTrue(true);
 }
Example #9
0
 public function setUp()
 {
     $serviceManager = Bootstrap::getServiceManager();
     $this->setApplicationConfig($serviceManager->get('ApplicationConfig'));
     $this->controller = new UserController($this->getApplicationServiceLocator());
     $this->controller->setTranslator($serviceManager->get('Translator'));
     $this->routeMatch = new RouteMatch(array('controller' => 'user'));
     $this->event = new MvcEvent();
     $config = $serviceManager->get('config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($serviceManager);
     parent::setUp();
 }
Example #10
0
 public function setUp()
 {
     $this->setApplicationConfig(include __DIR__ . '/../../../../../config/application.config.php');
     parent::setUp();
     $serviceManager = Bootstrap::getServiceManager();
     $this->controller = new CrudController();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->event = new MvcEvent();
     $config = $serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($serviceManager);
     $this->controller->em = $this->getMock('Doctrine\\ORM\\EntityManager', array('getRepository', 'getClassMetadata', 'persist', 'flush', 'find'), array(), '', false);
 }
Example #11
0
 public function setUp()
 {
     $serviceManager = Bootstrap::getServiceManager();
     $this->setApplicationConfig($serviceManager->get('ApplicationConfig'));
     $this->controller = new ListingController($this->getApplicationServiceLocator());
     $this->controller->setTranslator($serviceManager->get('Translator'));
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'listing'));
     $this->event = new MvcEvent();
     $config = $serviceManager->get('config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->entityManager = $this->controller->getServiceLocator()->get('entity-manager');
     $this->listingEntityClassName = get_class(new Listing());
     parent::setUp();
 }
Example #12
0
    {
        return static::$serviceManager;
    }
    protected static function initAutoloader()
    {
        $vendorPath = static::findParentPath('vendor');
        if (file_exists($vendorPath . '/autoload.php')) {
            include $vendorPath . '/autoload.php';
        }
        if (!class_exists('Zend\\Loader\\AutoloaderFactory')) {
            throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install`');
        }
        AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__))));
    }
    protected static function findParentPath($path)
    {
        $dir = __DIR__;
        $previousDir = '.';
        while (!is_dir($dir . '/' . $path)) {
            $dir = dirname($dir);
            if ($previousDir === $dir) {
                return false;
            }
            $previousDir = $dir;
        }
        return $dir . '/' . $path;
    }
}
Bootstrap::init();
Bootstrap::chroot();
     */
    public static $serviceManager;
    /**
     * Carry on the setup
     */
    public static function go()
    {
        // Make everything relative to the root
        chdir(dirname(__DIR__));
        // Setup autoloading
        require_once __DIR__ . '/../vendor/autoload.php';
        // Run application
        $config = (require 'config/application.config.php');
        \Zend\Mvc\Application::init($config);
        // Create the service manager and load modules
        $serviceManager = new ServiceManager(new ServiceManagerConfig());
        $serviceManager->setService('ApplicationConfig', $config);
        $serviceManager->get('ModuleManager')->loadModules();
        // Make service manager available for tests
        self::$serviceManager = $serviceManager;
    }
    /**
     * @return ServiceManager
     */
    public static function getServiceManager()
    {
        return self::$serviceManager;
    }
}
Bootstrap::go();
Example #14
0
 /**
  * Retorna o caminho do módulo
  * @return string O caminho do módulo no SO
  */
 public static function getModulePath()
 {
     return __DIR__ . '/../../../module/' . \Bootstrap::getModuleName();
 }
use Zend\Mvc\Service\ServiceManagerConfig;
use Zend\ServiceManager\ServiceManager;
use Zend\Stdlib\ArrayUtils;
use RuntimeException;
error_reporting(E_ALL | E_STRICT);
chdir(__DIR__);
class Bootstrap
{
    protected static $serviceManager;
    public static function init()
    {
        // Load the user-defined test configuration file, if it exists; otherwise, load
        $config = (include __DIR__ . '/config/application.config.php');
        static::initAutoloader();
        $serviceManager = new ServiceManager(new ServiceManagerConfig());
        $serviceManager->setService('ApplicationConfig', $config);
        $serviceManager->get('ModuleManager')->loadModules();
        static::$serviceManager = $serviceManager;
    }
    public static function getServiceManager()
    {
        return static::$serviceManager;
    }
    protected static function initAutoloader()
    {
        $loader = (include __DIR__ . '/init_autoloader.php');
        AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array('ApplicationTest' => __DIR__ . '/module/Application/test/ApplicationTest', 'UserTest' => __DIR__ . '/module/User/test/UserTest'))));
    }
}
Bootstrap::init();
Example #16
0
<?php

error_reporting(E_ALL | E_STRICT);
chdir(__DIR__);
date_default_timezone_set("Europe/Brussels");
\ApplicationTest\Bootstrap::init();
Example #17
0
<?php

//http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/getting-started.html#generating-the-database-schema
require_once __DIR__ . '/Bootstrap.php';
return \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet(\ApplicationTest\Bootstrap::getServiceManager()->get('entity-manager'));
Example #18
0
 private function getConfigurationHandler()
 {
     return Bootstrap::getServiceManager()->get('configuration-handler');
 }