當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Environment::hasConnection方法代碼示例

本文整理匯總了PHP中PSX\Test\Environment::hasConnection方法的典型用法代碼示例。如果您正苦於以下問題:PHP Environment::hasConnection方法的具體用法?PHP Environment::hasConnection怎麽用?PHP Environment::hasConnection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PSX\Test\Environment的用法示例。


在下文中一共展示了Environment::hasConnection方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     if (!Environment::hasConnection()) {
         $this->markTestSkipped('Database connection not available');
     }
 }
開發者ID:seytar,項目名稱:psx,代碼行數:7,代碼來源:SchemaCommandTest.php

示例2: getConnection

 public function getConnection()
 {
     if (!Environment::hasConnection()) {
         $this->markTestSkipped('No database connection available');
     }
     if (self::$con === null) {
         self::$con = Environment::getService('connection');
     }
     if ($this->connection === null) {
         $this->connection = self::$con;
     }
     return $this->createDefaultDBConnection($this->connection->getWrappedConnection(), Environment::getService('config')->get('psx_sql_db'));
 }
開發者ID:uqiauto,項目名稱:fusio,代碼行數:13,代碼來源:DbTestCase.php

示例3: testGet

 public function testGet()
 {
     $container = Environment::getContainer();
     // command
     $this->assertInstanceOf('PSX\\Dispatch\\CommandFactoryInterface', $container->get('command_factory'));
     $this->assertInstanceOf('PSX\\Command\\OutputInterface', $container->get('command_output'));
     $this->assertInstanceOf('PSX\\Command\\Executor', $container->get('executor'));
     // console
     $this->assertInstanceOf('Symfony\\Component\\Console\\Application', $container->get('console'));
     $this->assertInstanceOf('PSX\\Console\\ReaderInterface', $container->get('console_reader'));
     // controller
     $this->assertInstanceOf('PSX\\Dispatch\\ControllerFactoryInterface', $container->get('application_stack_factory'));
     $this->assertInstanceOf('PSX\\Dispatch\\ControllerFactoryInterface', $container->get('controller_factory'));
     $this->assertInstanceOf('PSX\\Dispatch\\SenderInterface', $container->get('dispatch_sender'));
     $this->assertInstanceOf('PSX\\Loader\\LocationFinderInterface', $container->get('loader_location_finder'));
     $this->assertInstanceOf('PSX\\Loader\\CallbackResolverInterface', $container->get('loader_callback_resolver'));
     $this->assertInstanceOf('PSX\\Loader', $container->get('loader'));
     $this->assertInstanceOf('PSX\\Dispatch\\RequestFactoryInterface', $container->get('request_factory'));
     $this->assertInstanceOf('PSX\\Dispatch\\ResponseFactoryInterface', $container->get('response_factory'));
     $this->assertInstanceOf('PSX\\Dispatch', $container->get('dispatch'));
     $this->assertInstanceOf('PSX\\Loader\\RoutingParserInterface', $container->get('routing_parser'));
     $this->assertInstanceOf('PSX\\Loader\\ReverseRouter', $container->get('reverse_router'));
     // data
     $this->assertInstanceOf('PSX\\Data\\ReaderFactory', $container->get('reader_factory'));
     $this->assertInstanceOf('PSX\\Data\\WriterFactory', $container->get('writer_factory'));
     $this->assertInstanceOf('PSX\\Data\\Transformer\\TransformerManager', $container->get('transformer_manager'));
     $this->assertInstanceOf('PSX\\Data\\Record\\ImporterManager', $container->get('importer_manager'));
     $this->assertInstanceOf('PSX\\Data\\Schema\\SchemaManagerInterface', $container->get('schema_manager'));
     $this->assertInstanceOf('PSX\\Data\\Schema\\ValidatorInterface', $container->get('schema_validator'));
     $this->assertInstanceOf('PSX\\Data\\Schema\\Assimilator', $container->get('schema_assimilator'));
     $this->assertInstanceOf('PSX\\Data\\Record\\FactoryFactory', $container->get('record_factory_factory'));
     $this->assertInstanceOf('PSX\\Data\\Importer', $container->get('importer'));
     $this->assertInstanceOf('PSX\\Data\\Extractor', $container->get('extractor'));
     $this->assertInstanceOf('PSX\\Data\\SerializerInterface', $container->get('serializer'));
     // default
     $this->assertInstanceOf('PSX\\Config', $container->get('config'));
     $this->assertInstanceOf('PSX\\Http', $container->get('http'));
     $this->assertInstanceOf('PSX\\Session', $container->get('session'));
     if (Environment::hasConnection()) {
         $this->assertInstanceOf('Doctrine\\DBAL\\Connection', $container->get('connection'));
         $this->assertInstanceOf('PSX\\Sql\\TableManager', $container->get('table_manager'));
     }
     $this->assertInstanceOf('PSX\\TemplateInterface', $container->get('template'));
     $this->assertInstanceOf('PSX\\Validate', $container->get('validate'));
     $this->assertInstanceOf('PSX\\Dependency\\ObjectBuilderInterface', $container->get('object_builder'));
     $this->assertInstanceOf('PSX\\Cache\\CacheItemPoolInterface', $container->get('cache'));
     $this->assertInstanceOf('Psr\\Log\\LoggerInterface', $container->get('logger'));
     // event
     $this->assertInstanceOf('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface', $container->get('event_dispatcher'));
 }
開發者ID:seytar,項目名稱:psx,代碼行數:50,代碼來源:DefaultContainerTest.php


注:本文中的PSX\Test\Environment::hasConnection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。