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


PHP Connections::config方法代码示例

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


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

示例1: testStreamConnection

 public function testStreamConnection()
 {
     $config = array('type' => 'Http', 'socket' => 'Stream', 'host' => 'localhost', 'login' => 'root', 'password' => '', 'port' => '80');
     Connections::add('stream-test', $config);
     $result = Connections::get('stream-test');
     $this->assertTrue($result instanceof Http);
     Connections::config(array('stream-test' => false));
 }
开发者ID:rmarscher,项目名称:lithium,代码行数:8,代码来源:ConnectionsTest.php

示例2: testAccessorMethods

 /**
  * Tests Collection accessors (getters/setters).
  */
 public function testAccessorMethods()
 {
     Connections::config(array('mock-source' => array('type' => 'lithium\\tests\\mocks\\data\\MockSource')));
     $model = $this->_model;
     $model::config(array('connection' => false, 'key' => 'id'));
     $collection = new DocumentSet(compact('model'));
     $this->assertEqual($model, $collection->model());
     $this->assertEqual(compact('model'), $collection->meta());
 }
开发者ID:nashadalam,项目名称:lithium,代码行数:12,代码来源:CollectionTest.php

示例3: testStreamConnection

 public function testStreamConnection()
 {
     $config = array('type' => 'Http', 'socket' => 'Stream', 'host' => 'localhost', 'login' => 'root', 'password' => '', 'port' => '80');
     Connections::add('stream-test', $config);
     $result = Connections::get('stream-test');
     $this->assertInstanceOf('lithium\\data\\source\\Http', $result);
     Connections::config(array('stream-test' => false));
 }
开发者ID:fedeisas,项目名称:lithium,代码行数:8,代码来源:ConnectionsTest.php

示例4: tearDown

 public function tearDown()
 {
     Connections::reset();
     Connections::config($this->_configs);
 }
开发者ID:rmarscher,项目名称:lithium,代码行数:5,代码来源:DatabaseTest.php

示例5: array

    if (!empty($solution)) {
        $default = array('id' => 'help-' . $checkName, 'title' => $checkName, 'content' => null);
        if (is_array($solution['content'])) {
            $solution['content'] = join("\n<br />", $solution['content']);
        }
        $solutions[$checkName] = $solution += $default;
    }
    return "<div class=\"test-result test-result-{$status}\">{$message}</div>";
};
$sanityChecks = array('resourcesWritable' => function () use($notify) {
    if (is_writable($path = realpath(LITHIUM_APP_PATH . '/resources'))) {
        return $notify(true, 'Resources directory is writable.');
    }
    return $notify(false, array("Your resource path (<code>{$path}</code>) is not writeable. " . "To fix this on *nix and Mac OSX, run the following from the command line:", "<code>chmod -R 0777 {$path}</code>"));
}, 'database' => function () use($notify) {
    $config = Connections::config();
    $boot = realpath(LITHIUM_APP_PATH . '/config/bootstrap.php');
    $connections = realpath(LITHIUM_APP_PATH . '/config/bootstrap/connections.php');
    if (empty($config)) {
        return $notify('notice', array('No database connections defined.'), array('title' => 'Database Connections', 'content' => array('To create a database connection, edit the file <code>' . $boot . '</code>, ', 'and uncomment the following line:', '<pre><code>require __DIR__ . \'/bootstrap/connections.php\';</code></pre>', 'Then, edit the file <code>' . $connections . '</code>.')));
    }
    return $notify(true, 'Database connection(s) configured.');
}, 'magicQuotes' => function () use($notify) {
    if (get_magic_quotes_gpc() === 0) {
        return;
    }
    return $notify(false, array("Magic quotes are enabled in your PHP configuration. Please set <code>" . "magic_quotes_gpc = Off</code> in your <code>php.ini</code> settings."));
}, 'registerGlobals' => function () use($notify) {
    if (!ini_get('register_globals')) {
        return;
    }
开发者ID:EHER,项目名称:chegamos,代码行数:31,代码来源:home.html.php

示例6: function

    if (!ini_get('register_globals')) {
        return;
    }
    return $notify('error', 'Register globals is enabled in your PHP configuration', 'Please set <code>register_globals = Off</code> in your <code>php.ini</code> settings.');
}, 'curlwrappers' => function () use($notify, $compiled) {
    if (!$compiled('with-curlwrappers')) {
        return;
    }
    return $notify('error', 'Curlwrappers are enabled, some things might not work as expected.', "This is an expiremental and usually broken feature of PHP.\n\t\t\tPlease recompile your PHP binary without using the <code>--with-curlwrappers</code>\n\t\t\tflag or use a precompiled binary that was compiled without the flag.");
}, 'shortOpenTag' => function () use($notify, $compiled) {
    if (!ini_get('short_open_tag')) {
        return;
    }
    return $notify('warning', 'Short open tags are enabled, you may want to disable them.', "It is recommended to not rely on this option being enabled.\n\t\t\tTo increase the portability of your code disable this option by setting\n\t\t\t<code>short_open_tag = Off</code> in your <code>php.ini</code>.");
}, 'database' => function () use($notify) {
    if ($config = Connections::config()) {
        return $notify('success', 'Database connection(s) configured');
    }
    return $notify('warning', 'No database connection defined', "To create a database connection:\n\t\t\t<ol>\n\t\t\t\t<li>Edit the file <code>config/bootstrap.php</code>.</li>\n\t\t\t\t<li>\n\t\t\t\t\tUncomment the line having\n\t\t\t\t\t<code>require __DIR__ . '/bootstrap/connections.php';</code>.\n\t\t\t\t</li>\n\t\t\t\t<li>Edit the file <code>config/bootstrap/connections.php</code>.</li>\n\t\t\t</ol>");
}, 'change' => function () use($notify, $self) {
    $template = $self->html->link('template', 'http://li3.me/docs/lithium/template');
    return $notify('warning', "You're using the application's default home page", "To change this {$template}, edit the file\n\t\t\t<code>views/pages/home.html.php</code>.\n\t\t\tTo change the layout,\n\t\t\t(that is what's wrapping content)\n\t\t\tedit the file <code>views/layouts/default.html.php</code>.");
}, 'dbSupport' => function () use($support) {
    $paths = array('data.source', 'adapter.data.source.database', 'adapter.data.source.http');
    $list = array();
    foreach ($paths as $path) {
        $list = array_merge($list, Libraries::locate($path, null, array('recursive' => false)));
    }
    $list = array_filter($list, function ($class) {
        return method_exists($class, 'enabled');
    });
开发者ID:unionofrad,项目名称:framework,代码行数:31,代码来源:home.html.php

示例7: testRelationshipGeneration

 public function testRelationshipGeneration()
 {
     Connections::add('mock-source', $this->_testConfig);
     $from = 'lithium\\tests\\mocks\\data\\MockComment';
     $to = 'lithium\\tests\\mocks\\data\\MockPost';
     $from::config(array('connection' => 'mock-source'));
     $to::config(array('connection' => 'mock-source'));
     $result = $this->db->relationship($from, 'belongsTo', 'MockPost');
     $expected = compact('from', 'to') + array('name' => 'MockPost', 'type' => 'belongsTo', 'keys' => array('mockComment' => '_id'), 'link' => 'contained', 'conditions' => null, 'fields' => true, 'fieldName' => 'mockPost', 'init' => true);
     $this->assertEqual($expected, $result->data());
     Connections::config(array('mock-source' => false));
 }
开发者ID:EHER,项目名称:chegamos,代码行数:12,代码来源:MongoDbTest.php

示例8: tearDown

 public function tearDown()
 {
     Connections::config(array('mock-source' => false));
     Connections::config($this->_configs);
 }
开发者ID:EHER,项目名称:monopolis,代码行数:5,代码来源:ModelTest.php

示例9: tearDown

 public function tearDown()
 {
     Connections::reset();
     Connections::config($this->_backup['connections']);
 }
开发者ID:radify,项目名称:li3_freshbooks,代码行数:5,代码来源:InvoicesTest.php


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