本文整理汇总了PHP中lime_test::comment方法的典型用法代码示例。如果您正苦于以下问题:PHP lime_test::comment方法的具体用法?PHP lime_test::comment怎么用?PHP lime_test::comment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lime_test
的用法示例。
在下文中一共展示了lime_test::comment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loremizeModule
public function loremizeModule($module, $nb = 10, lime_test $t = null)
{
if ($t) {
$t->comment('Loremizing module ' . $module . ' with ' . $nb . ' records');
}
$this->get('table_loremizer')->execute($this->getModule($module)->getTable(), $nb);
}
示例2: _createTmpGitRepo
/**
*
* @param lime_test $t
* @return PHPGit_Repository the git repo
*/
function _createTmpGitRepo(lime_test $t, array $options = array())
{
$repoDir = sys_get_temp_dir() . '/php-git-repo/' . uniqid();
$t->ok(!is_dir($repoDir . '/.git'), $repoDir . ' is not a Git repo');
try {
new PHPGit_Repository($repoDir, true, $options);
$t->fail($repoDir . ' is not a valid git repository');
} catch (InvalidArgumentException $e) {
$t->pass($repoDir . ' is not a valid git repository');
}
$t->comment('Create Git repo');
exec('git init ' . escapeshellarg($repoDir));
$t->ok(is_dir($repoDir . '/.git'), $repoDir . ' is a Git repo');
$repo = new PHPGit_Repository($repoDir, true, $options);
$t->isa_ok($repo, 'PHPGit_Repository', $repoDir . ' is a valid git repo');
$originalRepoDir = dirname(__FILE__) . '/repo';
foreach (array('README.markdown', 'index.php') as $file) {
copy($originalRepoDir . '/' . $file, $repoDir . '/' . $file);
}
return $repo;
}
示例3: dirname
<?php
require_once dirname(__FILE__) . '/../../../../test/bootstrap/unit.php';
$serviceContainer->pluginLoader->loadPlugins(array('nbAntPlugin'));
$t = new lime_test();
$client = new nbAntClient();
$t->comment('nbAntClientTest - Test command without options');
$t->is($client->getCommandLine('mycmd', array(), array()), 'ant mycmd');
$t->comment('nbAntClientTest - Test command with options');
$options = array('option' => 'value');
$t->is($client->getCommandLine('mycmd', array(), $options), 'ant mycmd -Doption=value');
// test command with arguments
$args = array('arg' => 'value');
$t->is($client->getCommandLine('mycmd', $args, array()), 'ant mycmd -Darg=value');
// test ANT cmd line options (library path)
$client->setLibraryPath("C:\\AntExtensions\\lib");
$t->is($client->getCommandLine('mycmd', $args, $options), 'ant -lib C:\\AntExtensions\\lib mycmd -Darg=value -Doption=value');
// test ANT cmd line options (property file)
$client->setPropertyFile("C:\\AntExtensions\\lib\\myfile.properties");
$t->is($client->getCommandLine('mycmd', $args, $options), 'ant -lib C:\\AntExtensions\\lib -propertyfile C:\\AntExtensions\\lib\\myfile.properties mycmd -Darg=value -Doption=value');
// test options with no value
// test ANT cmd line options (property file)
$options['incremental'] = '';
$t->is($client->getCommandLine('mycmd', $args, $options), 'ant -lib C:\\AntExtensions\\lib -propertyfile C:\\AntExtensions\\lib\\myfile.properties mycmd -Darg=value -Doption=value -Dincremental=true');
示例4: dirname
<?php
require_once dirname(__FILE__) . '/helper/dmUnitTestHelper.php';
$helper = new dmUnitTestHelper();
$helper->boot();
$t = new lime_test(33);
$v = new dmValidatorCssIdAndClasses();
$t->diag('->clean()');
foreach (array('a', 'a_b', 'a-c', 'qieurgfbqoiuzbfvoqiuzZFZGPSOZDNZKFjflzkh986875OoihzyfvbxoquyfvxqozufyxqzUEFV', '9', '_', ' bla rebla ', '- _ 8', '.class', '.a b.c.d', '#myid.a b.c.d', '#myid class1 class2', 'class1 class2 #myid', '.a b#myid.c.d', '.a b#myid.c.d#myid', '.a b#myid.c.d #myid', '#my_id', '#my-id', ' #my-id ') as $classes) {
try {
$t->comment('"' . $classes . '" -> "' . $v->clean($classes) . '"');
$t->pass('->clean() checks that the value is a valid css class name + id');
} catch (sfValidatorError $e) {
$t->fail('->clean() checks that the value is a valid css class name + id');
}
}
foreach (array('.zegze$g.zegf', '/', 'a/f', 'a^', 'a # @', 'é', '-{') as $nonClass) {
$t->comment($nonClass);
try {
$v->clean($nonClass);
$t->fail('->clean() throws an sfValidatorError if the value is not a valid css class name + id');
$t->skip('', 1);
} catch (sfValidatorError $e) {
$t->pass('->clean() throws an sfValidatorError if the value is not a valid css class name + id');
$t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError');
}
}
示例5: realpath
<?php
require_once realpath(dirname(__FILE__) . '/../../..') . '/unit/helper/dmModuleUnitTestHelper.php';
$helper = new dmModuleUnitTestHelper();
$helper->boot();
$t = new lime_test();
$table = dmDb::table('DmPage');
$page1 = $table->create(array('name' => 'name1', 'slug' => 'slug1', 'module' => 'test', 'action' => 'test1'));
$page1->Node->insertAsFirstChildOf($table->getTree()->fetchRoot());
$t->ok($page1->exists(), 'Created a page');
$t->is('slug1', $page1->slug, 'Page slug is slug1');
$t->comment('Saving page with existing slug');
$page2 = $table->create(array('name' => 'name2', 'slug' => 'slug1', 'module' => 'test', 'action' => 'test2'));
$page2->Node->insertAsFirstChildOf($table->getTree()->fetchRoot());
$t->ok($page2->exists(), 'Created a page');
$t->is($page2->slug, 'slug1-' . $page2->id, 'Page2 slug is slug1-' . $page2->id);
$page1->slug = 'slug1-' . $page2->id;
$page1->save();
$t->is($page1->slug, 'slug1-' . $page2->id . '-' . $page1->id, 'Page1 slug is now slug1-' . $page2->id . '-' . $page1->id);
$page2->slug = 'slug1';
$page2->save();
$t->is($page2->slug, 'slug1', 'Page2 slug is now slug1');
$page2->slug = '';
$page2->save();
$t->is($page2->slug, '/' . $page2->id, 'Page2 slug is now /' . $page2->id);
$page1->Node->moveAsFirstChildOf($page2);
$page2->refresh();
$page1->slug = $page2->slug;
$page1->save();
$t->is($page1->slug, $page2->slug . '/' . $page1->id, 'Page1 slug is now ' . $page2->slug . '/' . $page1->id);
//$helper->get('page_tree_watcher')->connect();
示例6: dirname
<?php
require_once dirname(__FILE__) . '/../bootstrap/unit.php';
require_once dirname(__FILE__) . '/../../lib/sfDynamics.class.php';
$testCount = 1;
class ManagerMock extends sfDynamicsManager
{
}
$t = new lime_test($testCount, new lime_output_color());
$t->comment('::getManager()');
if (!sfContext::hasInstance()) {
require_once $_SERVER['SYMFONY'] . '/autoload/sfCoreAutoload.class.php';
sfCoreAutoload::register();
require_once dirname(__FILE__) . '/../fixtures/project/config/ProjectConfiguration.class.php';
sfContext::createInstance(ProjectConfiguration::getApplicationConfiguration('frontend', 'test', isset($debug) ? $debug : true));
if (!sfContext::hasInstance()) {
$t->error('A context instance is required');
die;
}
$t->info('A frontend context has been initialized for tests');
}
sfConfig::set('app_sfDynamicsPlugin_manager', 'ManagerMock');
$t->isa_ok(sfDynamics::getManager(), 'ManagerMock', '::getManager() the manager class can be customized in app.yml');
示例7: isPluginEnabled
$dirTransferConfig = $configDir . '/filesystem-dir-transfer.yml';
function isPluginEnabled($beeConfig, $plugin)
{
if (!file_exists($beeConfig)) {
throw new Exception('bee config file not found');
}
$parser = sfYaml::load($beeConfig);
$plugins = isset($parser['project']['bee']['enabled_plugins']) ? $parser['project']['bee']['enabled_plugins'] : array();
return in_array($plugin, $plugins);
}
$t = new lime_test(12);
$cmd = new nbGenerateProjectCommand();
$t->ok($cmd->run(new nbCommandLineParser(), $projectDir), 'Command nbGenerateProjectCommand called successfully');
$t->ok(file_exists($beeConfig), 'bee.yml added to the destination dir :' . $beeConfig);
$t->ok(file_exists($config), 'config.yml added to the destination dir :' . $config);
$t->comment('enabling nbDummyPlugin');
$plugin = 'nbDummyPlugin';
$t->ok(!isPluginEnabled($beeConfig, $plugin), $plugin . ' not found');
$cmd = new nbEnablePluginCommand();
$t->ok($cmd->run(new nbCommandLineParser(), $plugin . ' ' . $projectDir), 'Plugin enabled successfully');
$t->ok(isPluginEnabled($beeConfig, $plugin), $plugin . ' found');
$t->comment('enabling a fake plugin');
$cmd = new nbEnablePluginCommand();
try {
$cmd->run(new nbCommandLineParser(), 'nbNonExistentPlugin' . ' ' . $projectDir);
$t->fail('plugin nbNonExistentPlugin exists ?');
} catch (Exception $e) {
$t->pass('plugin nbNonExistentPlugin not exists');
}
$t->comment('enabling nbFileSystemPlugin');
$secondPlugin = 'nbFileSystemPlugin';
示例8: dirname
*
*/
/**
* advanced rtShopVoucher Testing
*
* @package rtShopPlugin
* @author Piers Warmers <piers@wranglers.com.au>
* @author Konny Zurcher <konny@wranglers.com.au>
*/
include dirname(__FILE__) . '/../bootstrap/unit.php';
$t = new lime_test(16, new lime_output_color());
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'test', true);
$configuration->loadHelpers('Number');
sfContext::createInstance($configuration);
new sfDatabaseManager($configuration);
$t->comment('/////////////////////////////////////////////////////////////////////////////');
$t->comment('/// rtShopVoucher: Test range');
$t->comment('/////////////////////////////////////////////////////////////////////////////');
$numberFormat = new sfNumberFormat(sfContext::getInstance()->getUser()->getCulture());
// Tools
$tools = new rtShopVoucherRangeTestTools();
// Tax and shipping configurations
sfConfig::set('app_rt_shop_tax_rate', 10);
sfConfig::set('app_rt_shop_tax_mode', 'exclusive');
sfConfig::set('app_rt_shop_shipping_charges', array('default' => 20, 'AU' => 10, 'NZ' => 10));
// Add some data to play with...
$tools->clean();
// Products
try {
$prod1 = new rtShopProduct();
$prod1->setTitle('Product A');
示例9: dirname
<?php
require_once dirname(__FILE__) . '/../../../bootstrap/unit.php';
$t = new lime_test(0);
$t->comment('nbNumberCompare - Test compare');
示例10: dirname
<?php
require_once dirname(__FILE__) . '/../../../bootstrap/unit.php';
$t = new lime_test(40);
$fooArgument = new nbArgument('foo');
$barOption = new nbOption('bar');
$command1 = new DummyCommand("foo");
$command2 = new DummyCommand("ns:bar", new nbArgumentSet(array($fooArgument)));
$command3 = new DummyCommand("ns2:bas", null, new nbOptionSet(array($barOption)));
$t->comment('nbCommandTest - Test constructor');
try {
new DummyCommand('');
$t->fail('command name can\'t be empty');
} catch (InvalidArgumentException $e) {
$t->pass('command name can\'t be empty');
}
try {
new DummyCommand('ns:');
$t->fail('command name can\'t be empty');
} catch (InvalidArgumentException $e) {
$t->pass('command name can\'t be empty');
}
$command = new DummyCommand('foo');
$t->is($command->getArguments()->count(), 0, '->__construct() returns a command with no arguments');
$t->is($command->getOptions()->count(), 0, '->__construct() returns a command with no options');
$t->comment('nbCommandTest - Test name');
$t->is($command1->getName(), "foo", '->getName() returns a command with name "foo"');
$t->is($command2->getName(), "bar", '->getName() returns a command with name "bar"');
$t->comment('nbCommandTest - Test namespace');
$t->is($command1->getNamespace(), "", '->getNamespace() returns an empty namespace');
$t->is($command2->getNamespace(), "ns", '->getNamespace() returns a namespace "ns"');
示例11: dirname
<?php
require_once dirname(__FILE__) . '/../../vendor/lime.php';
require_once dirname(__FILE__) . '/../../lib/phpGitHubApi.php';
$t = new lime_test(3);
$api = new phpGitHubApi(true);
$t->comment('Test ->listIssues');
$issues = $api->listIssues('ornicar', 'php-github-api', 'closed');
$t->is($issues[0]['state'], 'closed', 'Found closed issues');
$t->comment('Test ->searchIssues');
$issues = $api->searchIssues('ornicar', 'php-github-api', 'closed', 'documentation');
$t->is($issues[0]['state'], 'closed', 'Found closed issues matching "documentation"');
$issue = $api->showIssue('ornicar', 'php-github-api', 1);
$t->is($issue['title'], 'Provide documentation', 'Found issue #1');
示例12:
$t->diag('Countable interface');
$t->is(count($pager), 20, 'Pager has 20 results');
// Iterator interface
$t->diag('Iterator interface');
$pager->init();
$normal = 0;
$iterated = 0;
foreach ($pager->getResults() as $object) {
$normal++;
}
foreach ($pager as $object) {
$iterated++;
}
$t->is($iterated, $normal, '"Iterator" interface loops over objects in the current pager');
$t->is($pager->getCurrent(), $query->fetchOne(), 'Found the first post');
$t->comment('Render navigation top');
$pattern = '<div class="pager"><ul class="clearfix"><li class="page current"><span class="link">1</span></li><li class="page">.+</li></ul></div>';
$t->like($navigation = $pager->renderNavigationTop(), '|^' . $pattern . '$|', 'navigation top: ' . $navigation);
$t->comment('Pass custom classes with array');
$pager->setOption('class', 'custom_class1 class2');
$pattern = '<div class="pager custom_class1 class2"><ul class="clearfix"><li class="page current"><span class="link">1</span></li><li class="page">.+</li></ul></div>';
$t->like($navigation = $pager->renderNavigationTop(), '|^' . $pattern . '$|', 'navigation top: ' . $navigation);
$t->comment('Pass custom classes with CSS expression');
$pager->setOption('class', null);
$pattern = '<div class="pager custom_class1 class2"><ul class="clearfix"><li class="page current"><span class="link">1</span></li><li class="page">.+</li></ul></div>';
$t->like($navigation = $pager->renderNavigationTop('.custom_class1.class2'), '|^' . $pattern . '$|', 'navigation top: ' . $navigation);
$t->comment('Disable navigation top');
$pager->setOption('class', null)->setOption('navigation_top', false);
$t->is($navigation = $pager->renderNavigationTop(), '', 'navigation top: ' . $navigation);
$t->comment('Pass custom separator');
$pager->setOption('navigation_top', true)->setOption('separator', '-');
示例13:
/*
* With some old version of sqlite, like on continuous integration server
* This test will not work as expected
*/
if (strpos(getcwd(), 'hudson')) {
return;
}
$t->ok($page = $domain->getDmPage(), 'Domain has a page');
$t->is(dmDb::table('DmPage')->count(), $nbPage + 1, 'One new page');
$t->is($page->isActive, false, 'The page is not active');
$t->is($page->Record, $domain, 'The page record is the domain');
$domain = dmDb::table('DmTestDomain')->create(array('title' => dmString::random(), 'is_active' => true))->saveGet();
$t->ok($domain->exists(), 'Record has been saved');
$t->ok($domain->isActive, 'Record is active');
$t->is(dmDb::table('DmPage')->count(), $nbPage + 1, 'No new page');
$t->ok($page = $domain->getDmPage(), 'Domain has a page');
$t->is(dmDb::table('DmPage')->count(), $nbPage + 2, 'One new page');
$t->is($page->isActive, true, 'The page is active');
$t->is($page->Record, $domain, 'The page record is the domain');
$categ = dmDb::table('DmTestCateg')->create(array('name' => dmString::random(), 'is_active' => false))->saveGet();
$t->is(dmDb::table('DmPage')->count(), $nbPage + 2, 'No new page');
$t->ok(!$categ->getDmPage(), 'Categ has a NO page');
$t->is(dmDb::table('DmPage')->count(), $nbPage + 2, 'No new page');
$t->comment('link the categ to a domain');
$categ->Domains->add($domain);
$categ->save();
$t->is(dmDb::table('DmPage')->count(), $nbPage + 2, 'No new page');
$t->ok($page = $categ->getDmPage(), 'Categ has a page');
$t->is(dmDb::table('DmPage')->count(), $nbPage + 3, 'One new page');
$t->is($page->isActive, false, 'The page is not active');
$t->is($page->Record, $categ, 'The page record is the categ');
示例14: dirname
<?php
require dirname(__FILE__) . '/../bootstrap/unit.php';
require dirname(__FILE__) . '/../../lib/model/sfAssetsManagerPackage.class.php';
$t = new lime_test(7, new lime_output_color());
$t->comment('Accessors');
$package = new sfAssetsManagerPackage('test');
$t->is($package->get('css'), array(), '->get() method returns an empty array by default');
$package->set('css', 'script.css');
$t->is($package->get('css'), array('script.css'), '->set() and ->get() write and read property');
$package->add('import', 'reference1');
$package->add('import', 'reference2');
$t->is($package->get('import'), array('reference1', 'reference2'), '->add() adds reference packages retrieved by ->get()');
$t->comment('Configuration from array');
$package = new sfAssetsManagerPackage('test2');
$package->fromArray(array('import' => 'reference', 'js' => 'script.js', 'css' => array('style1.css', 'style2.css')));
$t->is($package->get('import'), array('reference'), '->fromArray() inject imports property');
$t->is($package->get('js'), array('script.js'), '->fromArray() inject javascripts property');
$t->is($package->get('css'), array('style1.css', 'style2.css'), '->fromArray() inject stylesheets property');
$t->is_deeply($package->toArray(), array('import' => array('reference'), 'js' => array('script.js'), 'css' => array('style1.css', 'style2.css')), '->toArray() exports values into an array');
示例15: realpath
<?php
require_once realpath(dirname(__FILE__) . '/../../..') . '/unit/helper/dmUnitTestHelper.php';
$helper = new dmUnitTestHelper();
$helper->boot('front');
$t = new lime_test(39);
$wtm = $helper->get('widget_type_manager');
$widgetType = $wtm->getWidgetType('dmWidgetNavigation', 'menu');
$formClass = $widgetType->getOption('form_class');
$page1 = dmDb::table('DmPage')->findOneByModuleAndAction('main', 'page1');
$t->comment('Create a menu widget');
$widget = dmDb::create('DmWidget', array('module' => $widgetType->getModule(), 'action' => $widgetType->getAction(), 'value' => '[]', 'dm_zone_id' => $page1->PageView->Area->Zones[0]));
$t->comment('Create a ' . $formClass . ' instance');
$form = new $formClass($widget);
$form->removeCsrfProtection();
$html = $form->render();
$t->like($html, '_^<form\\s(.|\\n)*</form>$_', 'Successfully obtained and rendered a ' . $formClass . ' instance');
$t->is(count($form->getStylesheets()), 2, 'This widget form requires 2 additional stylesheets');
$t->is(count($form->getJavascripts()), 3, 'This widget form requires 3 additional javascripts');
$t->comment('Submit an empty form');
$form->bind(array(), array());
$t->is($form->isValid(), true, 'The form is valid');
$t->comment('Save the widget');
$form->updateWidget()->save();
$t->ok($widget->exists(), 'Widget has been saved');
$expected = array('ulClass' => '', 'liClass' => '', 'items' => array());
$t->is_deeply($widget->values, $expected, 'Widget values are correct');
$t->comment('Recreate the form from the saved widget');
$form = new $formClass($widget);
$form->removeCsrfProtection();
$t->is($form->getDefault('link'), array(), 'The form default text is correct');