当前位置: 首页>>代码示例>>PHP>>正文


PHP PhraseanetTestCase::booted方法代码示例

本文整理汇总了PHP中PhraseanetTestCase::booted方法的典型用法代码示例。如果您正苦于以下问题:PHP PhraseanetTestCase::booted方法的具体用法?PHP PhraseanetTestCase::booted怎么用?PHP PhraseanetTestCase::booted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhraseanetTestCase的用法示例。


在下文中一共展示了PhraseanetTestCase::booted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     if (null !== self::$DI) {
         unset(self::$DI['app']['dbal.provider']);
     }
     self::$DI = new \Pimple();
     ini_set('memory_limit', '4096M');
     \PHPUnit_Framework_Error_Warning::$enabled = true;
     \PHPUnit_Framework_Error_Notice::$enabled = true;
     self::$DI['app'] = self::$DI->share(function ($DI) {
         return $this->loadApp('/lib/Alchemy/Phrasea/Application/Root.php');
     });
     self::$DI['cli'] = self::$DI->share(function ($DI) {
         return $this->loadCLI();
     });
     self::$DI['local-guzzle'] = self::$DI->share(function ($DI) {
         return new Guzzle(self::$DI['app']['conf']->get('servername'));
     });
     self::$DI['client'] = self::$DI->share(function ($DI) {
         return new Client($DI['app'], []);
     });
     self::$DI['user'] = self::$DI->share(function ($DI) {
         return $DI['app']['manipulator.user']->getRepository()->find(self::$fixtureIds['user']['test_phpunit']);
     });
     self::$DI['user_1'] = self::$DI->share(function ($DI) {
         return $DI['app']['manipulator.user']->getRepository()->find(self::$fixtureIds['user']['user_1']);
     });
     self::$DI['user_2'] = self::$DI->share(function ($DI) {
         return $DI['app']['manipulator.user']->getRepository()->find(self::$fixtureIds['user']['user_2']);
     });
     self::$DI['user_3'] = self::$DI->share(function ($DI) {
         return $DI['app']['manipulator.user']->getRepository()->find(self::$fixtureIds['user']['user_3']);
     });
     self::$DI['user_guest'] = self::$DI->share(function ($DI) {
         return $DI['app']['manipulator.user']->getRepository()->find(self::$fixtureIds['user']['user_guest']);
     });
     self::$DI['user_notAdmin'] = self::$DI->share(function ($DI) {
         return $DI['app']['manipulator.user']->getRepository()->find(self::$fixtureIds['user']['test_phpunit_not_admin']);
     });
     self::$DI['user_alt1'] = self::$DI->share(function ($DI) {
         return $DI['app']['manipulator.user']->getRepository()->find(self::$fixtureIds['user']['test_phpunit_alt1']);
     });
     self::$DI['user_alt2'] = self::$DI->share(function ($DI) {
         return $DI['app']['manipulator.user']->getRepository()->find(self::$fixtureIds['user']['test_phpunit_alt2']);
     });
     self::$DI['user_template'] = self::$DI->share(function ($DI) {
         return $DI['app']['manipulator.user']->getRepository()->find(self::$fixtureIds['user']['user_template']);
     });
     self::$DI['registration_1'] = self::$DI->share(function ($DI) {
         return $DI['app']['manipulator.registration']->getRepository()->find(self::$fixtureIds['registrations']['registration_1']);
     });
     self::$DI['registration_2'] = self::$DI->share(function ($DI) {
         return $DI['app']['manipulator.registration']->getRepository()->find(self::$fixtureIds['registrations']['registration_2']);
     });
     self::$DI['registration_3'] = self::$DI->share(function ($DI) {
         return $DI['app']['manipulator.registration']->getRepository()->find(self::$fixtureIds['registrations']['registration_3']);
     });
     self::$DI['oauth2-app-user'] = self::$DI->share(function ($DI) {
         return new \API_OAuth2_Application($DI['app'], self::$fixtureIds['oauth']['user']);
     });
     self::$DI['oauth2-app-user_notAdmin'] = self::$DI->share(function ($DI) {
         return new \API_OAuth2_Application($DI['app'], self::$fixtureIds['oauth']['user_notAdmin']);
     });
     self::$DI['logger'] = self::$DI->share(function () {
         $logger = new Logger('tests');
         $logger->pushHandler(new NullHandler());
         return $logger;
     });
     self::$DI['collection'] = self::$DI->share(function ($DI) {
         return collection::get_from_base_id($DI['app'], self::$fixtureIds['collection']['coll']);
     });
     self::$DI['collection_no_access'] = self::$DI->share(function ($DI) {
         return collection::get_from_base_id($DI['app'], self::$fixtureIds['collection']['coll_no_access']);
     });
     self::$DI['collection_no_access_by_status'] = self::$DI->share(function ($DI) {
         return collection::get_from_base_id($DI['app'], self::$fixtureIds['collection']['coll_no_status']);
     });
     if (!self::$booted) {
         if (!self::$DI['app']['phraseanet.configuration-tester']->isInstalled()) {
             echo "[0;31mPhraseanet is not set up[0;37m\n";
             exit(1);
         }
         self::$fixtureIds = array_merge(self::$fixtureIds, json_decode(file_get_contents(__DIR__ . '/../fixtures.json'), true));
         self::resetUsersRights(self::$DI['app'], self::$DI['user']);
         self::resetUsersRights(self::$DI['app'], self::$DI['user_notAdmin']);
         self::$booted = true;
     }
     self::$DI['lazaret_1'] = self::$DI->share(function ($DI) {
         return $DI['app']['EM']->find('Phraseanet:LazaretFile', self::$fixtureIds['lazaret']['lazaret_1']);
     });
     foreach (range(1, 7) as $i) {
         self::$DI['record_' . $i] = self::$DI->share(function ($DI) use($i) {
             return new \record_adapter($DI['app'], self::$fixtureIds['databox']['records'], self::$fixtureIds['record']['record_' . $i]);
         });
     }
     foreach (range(1, 3) as $i) {
         self::$DI['record_story_' . $i] = self::$DI->share(function ($DI) use($i) {
             return new \record_adapter($DI['app'], self::$fixtureIds['databox']['records'], self::$fixtureIds['record']['record_story_' . $i]);
         });
//.........这里部分代码省略.........
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:101,代码来源:PhraseanetTestCase.php


注:本文中的PhraseanetTestCase::booted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。