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


PHP Bootstrap::setApplication方法代码示例

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


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

示例1: testLoad

 public function testLoad()
 {
     global $testHelpers;
     $app = $testHelpers->getAppWithMockCli();
     Bootstrap::setApplication($app);
     $extensions = $app['extensions'];
     $extensions->init();
 }
开发者ID:eriktorsner,项目名称:wp-bootstrap-test,代码行数:8,代码来源:ExtensionsTest.php

示例2: runSetup

 private function runSetup()
 {
     global $testHelpers;
     $app = $testHelpers->getAppWithMockCli();
     Bootstrap::setApplication($app);
     require_once WPBOOT_BASEPATH . '/www/wordpress-test/wp-load.php';
     $setup = $app['setup'];
     $setup->run([], []);
 }
开发者ID:eriktorsner,项目名称:wp-bootstrap-test,代码行数:9,代码来源:LocalPluginTest.php

示例3: testResolvePostMetaReferences

 public function testResolvePostMetaReferences()
 {
     global $testHelpers;
     $app = $testHelpers->getAppWithMockCli();
     Bootstrap::setApplication($app);
     $r = $app['resolver'];
     $i = $app['import'];
     $testHelpers->makePublic($i, 'posts');
     $i->posts = [(object) ['id' => 10, 'post' => ['ID' => 12, 'post_meta' => ['foobar' => [12, 'x:12']]]]];
     \WP_Mock::wpFunction('update_post_meta', ['args' => [10, 'foobar', 10, 12], 'times' => 1]);
     \WP_Mock::wpFunction('update_post_meta', ['args' => [10, 'foobar', 'x:10', 'x:12'], 'times' => 1]);
     $references = ['foobar'];
     $r->resolvePostMetaReferences($references, 'post');
 }
开发者ID:eriktorsner,项目名称:wp-bootstrap-test,代码行数:14,代码来源:ResolverTest.php

示例4: testRemoveLastSizeIndicator

 public function testRemoveLastSizeIndicator()
 {
     global $testHelpers;
     $app = $testHelpers->getAppWithMockCli();
     Bootstrap::setApplication($app);
     $e = $app['extractmedia'];
     $testStrings = array('http://foo.com/a.b.d-1x1-150x150.png', 'http://foo.com/a.b.d-1123x19999-150x150.png', 'http://foo.com/a.b.d-1123x19999-1123x19999.png', 'a.b.d-150x150.png');
     $expectedStrings = array('http://foo.com/a.b.d-1x1.png', 'http://foo.com/a.b.d-1123x19999.png', 'http://foo.com/a.b.d-1123x19999.png', 'a.b.d.png');
     for ($i = 0; $i < count($testStrings); ++$i) {
         $test = $testStrings[$i];
         $expected = $expectedStrings[$i];
         $result = $e->removeLastSizeIndicator($test);
         $this->assertEquals($expected, $result);
     }
 }
开发者ID:eriktorsner,项目名称:wp-bootstrap-test,代码行数:15,代码来源:FunctionsTest.php

示例5: testEnsureDefineInFile

 public function testEnsureDefineInFile()
 {
     global $testHelpers;
     $app = $testHelpers->getAppWithMockCli();
     Bootstrap::setApplication($app);
     $h = $app['helpers'];
     $file = WPBOOT_BASEPATH . '/test-config.php';
     file_put_contents($file, "<?php\n\n");
     $h->ensureDefineInFile($file, 'foobar', 'foovalue');
     $lines = file($file);
     $patterns = [preg_quote("/Added by WP Bootstrap/"), preg_quote("/if (!defined('foobar'))/"), preg_quote("/define('foobar', 'foovalue');/")];
     foreach ($patterns as $pattern) {
         $this->assertTrue(count(preg_grep($pattern, $lines)) > 0);
     }
     $h->ensureDefineInFile($file, 'foobar', 'foovalue2');
     $lines = file($file);
     $patterns = [preg_quote("/Added by WP Bootstrap/"), preg_quote("/if (!defined('foobar'))/"), preg_quote("/define('foobar', 'foovalue2');/")];
     foreach ($patterns as $pattern) {
         $this->assertTrue(count(preg_grep($pattern, $lines)) > 0);
     }
     $h->ensureDefineInFile($file . 'jada', 'foobar', 'foovalue2');
     foreach ($patterns as $pattern) {
         $this->assertTrue(count(preg_grep($pattern, $lines)) > 0);
     }
 }
开发者ID:eriktorsner,项目名称:wp-bootstrap-test,代码行数:25,代码来源:HelpersTest.php


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