本文整理汇总了PHP中Bootstrap::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Bootstrap::factory方法的具体用法?PHP Bootstrap::factory怎么用?PHP Bootstrap::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bootstrap
的用法示例。
在下文中一共展示了Bootstrap::factory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
/**
* @param string $file
* @param string $content
* @return boolean
*/
public function write($file, $content)
{
$pathSavePHPUnit = Bootstrap::factory()->config('config.output.phpunit');
$pathReadFiles = Bootstrap::factory()->config('config.input.selenium');
$namespaces = explode('/', str_replace(array('_de_', '_', $pathReadFiles . '/', '.selenium'), array('De', '', '', ''), $file));
$namespaces[1] = "Suite{$namespaces[1]}";
$tmplStaticPageTest = file_get_contents('templates/TemplateStaticPageTest.php');
$tmplSuitePageTest = file_get_contents('templates/TemplateSuitePageTest.php');
$tmplTestPageTest = file_get_contents('templates/TemplateTestPageTest.php');
//write function
$tmplStaticPageTest = str_replace(array('CLASS_NAME', 'FUNCTION_NAME'), array($namespaces[0], $namespaces[0]), $tmplStaticPageTest);
$s1 = @file_put_contents("{$pathSavePHPUnit}/TemplateStaticPage{$namespaces[0]}Test.php", $tmplStaticPageTest);
//write suite
$tmplSuitePageTest = str_replace(array('CLASS_NAME', 'FUNCTION_NAME', 'SUITE_NAME'), array($namespaces[0] . $namespaces[1], $namespaces[0], $namespaces[1]), $tmplSuitePageTest);
$s2 = @file_put_contents("{$pathSavePHPUnit}/TemplateSuitePage{$namespaces[1]}Test.php", $tmplSuitePageTest);
//write test
$tmplTestPageTest = str_replace(array('CONTENT_XEBIUM', 'CLASS_NAME', 'FUNCTION_NAME', 'SUITE_NAME', 'TEST_NAME'), array($content, $namespaces[0] . $namespaces[1] . $namespaces[2], $namespaces[0], "{$namespaces[1]}", $namespaces[2]), $tmplTestPageTest);
$s3 = @file_put_contents("{$pathSavePHPUnit}/TemplateTestPage{$namespaces[2]}Test.php", $tmplTestPageTest);
if (!$s1) {
throw new Exception('Ocorreu um erro na criação da classe TemplateStaticPage!');
}
if (!$s2) {
throw new Exception('Ocorreu um erro na criação da classe TemplateSuitePage!');
}
if (!$s3) {
throw new Exception('Ocorreu um erro na criação da classe TemplateTestPage!');
}
return true;
}
示例2: foreach
<div class="row">
<div class="span12">
<p id="textDisplay">0/0</p>
<div class="progress progress-warning">
<div id="barDisplay" class="bar" style="width: 0%;"></div>
</div>
</div>
</div>
<hr>
<hr>
<?php
$i = 0;
?>
<?php
foreach (Read::factory()->directoryToArray(Bootstrap::factory()->config('config.input.selenium'), true) as $key => $path) {
?>
<?php
if (strpos($path, '.selenium') !== false) {
?>
<div class="row test" id='row<?php
print ++$i;
?>
'>
<div class="span12">
<p><?php
print "[{$i}] [<a class='run-unit' test='{$i}' href='#'>run</a>] {$path}";
?>
</p>
<input class="path" type="hidden" value="<?php
print $path;
示例3: file_get_html
<?php
require 'classes/Bootstrap.php';
require 'vendor/domhtmlparse/simple_html_dom.php';
$path = $_REQUEST['path'];
$html = file_get_html($path);
$name = '';
$command = "commands[%d] = new Command('%s', '%s', '%s');\n";
$commands = '';
$url = $html->find('link', 0)->href;
$key = 0;
foreach ($html->find('tr') as $i => $trs) {
if (!$key) {
$name = $trs->find('td', 0)->innertext;
//add test login ...
//require commands ...
$commands .= sprintf($command, $key, 'open', '/', '');
$commands .= sprintf($command, ++$key, 'type', 'id=USUARIO', Bootstrap::factory()->config('config.app.auth.user'));
$commands .= sprintf($command, ++$key, 'type', 'id=SENHA', Bootstrap::factory()->config('config.app.auth.pass'));
$commands .= sprintf($command, ++$key, 'clickAndWait', 'css=img.botao48', '');
$commands .= sprintf($command, ++$key, 'assertText', 'css=span.style25', 'Olá, Administrador - Setor de Gerência da Informação.');
continue;
}
$commands .= sprintf($command, ++$key, $trs->find('td', 0)->innertext, str_replace(array('\\', "'"), array('\\\\', '"'), $trs->find('td', 1)->innertext), str_replace(array('\\', "'"), array('\\\\', '"'), $trs->find('td', 2)->innertext));
}
$script = "\n var transport = {};\n \n var testCase = new TestCase('%s');\n testCase.setBaseURL('%s');\n var commands = []; \n %s\n testCase.setCommands(commands);\n \n transport.xebium = format(testCase, '%s','" . Bootstrap::factory()->config('config.app.url.base') . "');\n transport.url = '%s';\n transport.name = '%s';\n transport.path = '%s';\n ";
print sprintf($script, $name, $url, $commands, $name, $url, $name, $path);