• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP LimeTest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __construct

 public function __construct($plan = null, $options = array())
 {
     // for BC
     if (!is_array($options)) {
         $options = array();
         // drop the old output because it is not compatible with LimeTest
     }
     parent::__construct($plan, $options);
 }
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:9,代码来源:lime.php


示例2: __construct

 public function __construct($plan = null, array $options = array())
 {
     parent::__construct($plan, $options);
     $this->testRunner = new LimeTestRunner($this->getOutput());
     $this->testRunner->addBefore(array($this, 'setUp'));
     $this->testRunner->addAfter(array($this, 'tearDown'));
     // attention: the following lines are not tested
     $this->testRunner->addExceptionHandler(array($this, 'handleException'));
     $this->testRunner->addAfter(array($this, 'verifyException'));
     foreach (get_class_methods($this) as $method) {
         if (strpos($method, 'test') === 0 && strlen($method) > 4) {
             $this->testRunner->addTest(array($this, $method), $this->humanize($method));
         }
     }
 }
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:15,代码来源:LimeTestCase.php


示例3: __construct

 public function __construct(LimeConfiguration $configuration = null)
 {
     parent::__construct($configuration);
     $this->testRunner = new LimeTestRunner($this->getOutput());
     $this->testRunner->addBefore(array($this, 'beginTest'));
     $this->testRunner->addBefore(array($this, 'setUp'));
     $this->testRunner->addAfter(array($this, 'tearDown'));
     // attention: the following lines are not tested
     $this->testRunner->addExceptionHandler(array($this, 'handleException'));
     $this->testRunner->addAfter(array($this, 'endTest'));
     $class = new ReflectionClass($this);
     foreach ($class->getMethods() as $method) {
         if (strpos($method->getName(), 'test') === 0 && strlen($method->getName()) > 4) {
             $this->testRunner->addTest(array($this, $method->getName()), $this->humanize($method->getName()), $method->getFileName(), $method->getStartLine());
         }
     }
 }
开发者ID:b00giZm,项目名称:lime,代码行数:17,代码来源:LimeTestCase.php


示例4: LimeTest

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <[email protected]>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../../bootstrap.php';
use Symfony\Components\DependencyInjection\Builder;
use Symfony\Components\DependencyInjection\Dumper\GraphvizDumper;
$t = new LimeTest(4);
$fixturesPath = __DIR__ . '/../../../../../fixtures/Symfony/Components/DependencyInjection/';
// ->dump()
$t->diag('->dump()');
$dumper = new GraphvizDumper($container = new Builder());
$t->is($dumper->dump(), file_get_contents($fixturesPath . '/graphviz/services1.dot'), '->dump() dumps an empty container as an empty dot file');
$container = new Builder();
$dumper = new GraphvizDumper($container);
$container = (include $fixturesPath . '/containers/container9.php');
$dumper = new GraphvizDumper($container);
$t->is($dumper->dump(), str_replace('%path%', __DIR__, file_get_contents($fixturesPath . '/graphviz/services9.dot')), '->dump() dumps services');
$container = (include $fixturesPath . '/containers/container10.php');
$dumper = new GraphvizDumper($container);
$t->is($dumper->dump(), str_replace('%path%', __DIR__, file_get_contents($fixturesPath . '/graphviz/services10.dot')), '->dump() dumps services');
$container = (include $fixturesPath . '/containers/container10.php');
$dumper = new GraphvizDumper($container);
$t->is($dumper->dump(array('graph' => array('ratio' => 'normal'), 'node' => array('fontsize' => 13, 'fontname' => 'Verdana', 'shape' => 'square'), 'edge' => array('fontsize' => 12, 'fontname' => 'Verdana', 'color' => 'white', 'arrowhead' => 'closed', 'arrowsize' => 1), 'node.instance' => array('fillcolor' => 'green', 'style' => 'empty'), 'node.definition' => array('fillcolor' => 'grey'), 'node.missing' => array('fillcolor' => 'red', 'style' => 'empty'))), str_replace('%path%', __DIR__, file_get_contents($fixturesPath . '/graphviz/services10-1.dot')), '->dump() dumps services');
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:29,代码来源:GraphvizDumperTest.php


示例5: LimeTest

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../../bootstrap.php';
use Symfony\Components\CLI\Output\NullOutput;
$t = new LimeTest(1);
$output = new NullOutput();
$output->write('foo');
$t->pass('->write() does nothing');
开发者ID:vjousse,项目名称:symfony,代码行数:15,代码来源:NullOutputTest.php


示例6: LimeTest

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../../bootstrap.php';
use Symfony\Components\CLI\Tester\CommandTester;
use Symfony\Components\CLI\Command\HelpCommand;
use Symfony\Components\CLI\Command\ListCommand;
use Symfony\Components\CLI\Application;
$t = new LimeTest(4);
// ->execute()
$t->diag('->execute()');
$command = new HelpCommand();
$command->setCommand(new ListCommand());
$commandTester = new CommandTester($command);
$commandTester->execute(array());
$t->like($commandTester->getDisplay(), '/list \\[--xml\\] \\[namespace\\]/', '->execute() returns a text help for the given command');
$commandTester->execute(array('--xml' => true));
$t->like($commandTester->getDisplay(), '/<command/', '->execute() returns an XML help text if --xml is passed');
$application = new Application();
$commandTester = new CommandTester($application->getCommand('help'));
$commandTester->execute(array('command_name' => 'list'));
$t->like($commandTester->getDisplay(), '/list \\[--xml\\] \\[namespace\\]/', '->execute() returns a text help for the given command');
$commandTester->execute(array('command_name' => 'list', '--xml' => true));
$t->like($commandTester->getDisplay(), '/<command/', '->execute() returns an XML help text if --xml is passed');
开发者ID:vjousse,项目名称:symfony,代码行数:30,代码来源:HelpCommandTest.php


示例7: LimeTest

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../bootstrap.php';
use Symfony\Components\Yaml\Yaml;
use Symfony\Components\Yaml\Inline;
Yaml::setSpecVersion('1.1');
$t = new LimeTest(124);
// ::load()
$t->diag('::load()');
$testsForLoad = array('' => '', 'null' => null, 'false' => false, 'true' => true, '12' => 12, '"quoted string"' => 'quoted string', "'quoted string'" => 'quoted string', '12.30e+02' => 1230.0, '0x4D2' => 0x4d2, '02333' => 02333, '.Inf' => -log(0), '-.Inf' => log(0), '123456789123456789' => '123456789123456789', '"foo\\r\\nbar"' => "foo\r\nbar", "'foo#bar'" => 'foo#bar', "'foo # bar'" => 'foo # bar', "'#cfcfcf'" => '#cfcfcf', '2007-10-30' => mktime(0, 0, 0, 10, 30, 2007), '2007-10-30T02:59:43Z' => gmmktime(2, 59, 43, 10, 30, 2007), '2007-10-30 02:59:43 Z' => gmmktime(2, 59, 43, 10, 30, 2007), '"a \\"string\\" with \'quoted strings inside\'"' => 'a "string" with \'quoted strings inside\'', "'a \"string\" with ''quoted strings inside'''" => 'a "string" with \'quoted strings inside\'', '[foo, http://urls.are/no/mappings, false, null, 12]' => array('foo', 'http://urls.are/no/mappings', false, null, 12), '[  foo  ,   bar , false  ,  null     ,  12  ]' => array('foo', 'bar', false, null, 12), '[\'foo,bar\', \'foo bar\']' => array('foo,bar', 'foo bar'), '{foo:bar,bar:foo,false:false,null:null,integer:12}' => array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), '{ foo  : bar, bar : foo,  false  :   false,  null  :   null,  integer :  12  }' => array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), '{foo: \'bar\', bar: \'foo: bar\'}' => array('foo' => 'bar', 'bar' => 'foo: bar'), '{\'foo\': \'bar\', "bar": \'foo: bar\'}' => array('foo' => 'bar', 'bar' => 'foo: bar'), '{\'foo\'\'\': \'bar\', "bar\\"": \'foo: bar\'}' => array('foo\'' => 'bar', "bar\"" => 'foo: bar'), '{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}' => array('foo: ' => 'bar', "bar: " => 'foo: bar'), '[foo, [bar, foo]]' => array('foo', array('bar', 'foo')), '[foo, {bar: foo}]' => array('foo', array('bar' => 'foo')), '{ foo: {bar: foo} }' => array('foo' => array('bar' => 'foo')), '{ foo: [bar, foo] }' => array('foo' => array('bar', 'foo')), '[  foo, [  bar, foo  ]  ]' => array('foo', array('bar', 'foo')), '[{ foo: {bar: foo} }]' => array(array('foo' => array('bar' => 'foo'))), '[foo, [bar, [foo, [bar, foo]], foo]]' => array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo')), '[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]' => array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo'))), '[foo, bar: { foo: bar }]' => array('foo', '1' => array('bar' => array('foo' => 'bar'))));
foreach ($testsForLoad as $yaml => $value) {
    $t->is(Inline::load($yaml), $value, sprintf('::load() converts an inline YAML to a PHP structure (%s)', $yaml));
}
$testsForDump = array('null' => null, 'false' => false, 'true' => true, '12' => 12, "'quoted string'" => 'quoted string', '12.30e+02' => 1230.0, '1234' => 0x4d2, '1243' => 02333, '.Inf' => -log(0), '-.Inf' => log(0), '"foo\\r\\nbar"' => "foo\r\nbar", "'foo#bar'" => 'foo#bar', "'foo # bar'" => 'foo # bar', "'#cfcfcf'" => '#cfcfcf', "'a \"string\" with ''quoted strings inside'''" => 'a "string" with \'quoted strings inside\'', '[foo, bar, false, null, 12]' => array('foo', 'bar', false, null, 12), '[\'foo,bar\', \'foo bar\']' => array('foo,bar', 'foo bar'), '{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }' => array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), '{ foo: bar, bar: \'foo: bar\' }' => array('foo' => 'bar', 'bar' => 'foo: bar'), '[foo, [bar, foo]]' => array('foo', array('bar', 'foo')), '[foo, [bar, [foo, [bar, foo]], foo]]' => array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo')), '{ foo: { bar: foo } }' => array('foo' => array('bar' => 'foo')), '[foo, { bar: foo }]' => array('foo', array('bar' => 'foo')), '[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]' => array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo'))));
// ::dump()
$t->diag('::dump()');
foreach ($testsForDump as $yaml => $value) {
    $t->is(Inline::dump($value), $yaml, sprintf('::dump() converts a PHP structure to an inline YAML (%s)', $yaml));
}
foreach ($testsForLoad as $yaml => $value) {
    if ($value == 1230) {
        continue;
    }
    $t->is(Inline::load(Inline::dump($value)), $value, 'check consistency');
开发者ID:pablosik,项目名称:symfony,代码行数:31,代码来源:InlineTest.php


示例8: LimeTest

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <[email protected]>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../bootstrap.php';
use Symfony\Components\DependencyInjection\Definition;
$t = new LimeTest(21);
// __construct()
$t->diag('__construct()');
$def = new Definition('stdClass');
$t->is($def->getClass(), 'stdClass', '__construct() takes the class name as its first argument');
$def = new Definition('stdClass', array('foo'));
$t->is($def->getArguments(), array('foo'), '__construct() takes an optional array of arguments as its second argument');
// ->setConstructor() ->getConstructor()
$t->diag('->setConstructor() ->getConstructor()');
$def = new Definition('stdClass');
$t->is(spl_object_hash($def->setConstructor('foo')), spl_object_hash($def), '->setConstructor() implements a fluent interface');
$t->is($def->getConstructor(), 'foo', '->getConstructor() returns the constructor name');
// ->setClass() ->getClass()
$t->diag('->setClass() ->getClass()');
$def = new Definition('stdClass');
$t->is(spl_object_hash($def->setClass('foo')), spl_object_hash($def), '->setClass() implements a fluent interface');
$t->is($def->getClass(), 'foo', '->getClass() returns the class name');
// ->setArguments() ->getArguments() ->addArgument()
$t->diag('->setArguments() ->getArguments() ->addArgument()');
$def = new Definition('stdClass');
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:31,代码来源:DefinitionTest.php


示例9: LimeTest

<?php

/*
 * This file is part of the Lime framework.
 *
 * (c) Fabien Potencier <[email protected]>
 * (c) Bernhard Schussek <[email protected]>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */
LimeAnnotationSupport::enable();
$t = new LimeTest();
// @Test: is() throws an exception if keys are missing
// fixtures
$actual = new LimeTesterArray(array());
$expected = new LimeTesterArray(array(0 => 1));
// test
$t->expect('LimeAssertionFailedException');
$actual->is($expected);
// @Test: is() throws an exception if keys are unexpected
// fixtures
$actual = new LimeTesterArray(array(0 => 1));
$expected = new LimeTesterArray(array());
// test
$t->expect('LimeAssertionFailedException');
$actual->is($expected);
// @Test: is() throws an exception if values don't match
// fixtures
$actual = new LimeTesterArray(array(0 => 1));
$expected = new LimeTesterArray(array(0 => 2));
开发者ID:b00giZm,项目名称:lime,代码行数:31,代码来源:LimeTesterArrayTest.php


示例10: LimeTest

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../../bootstrap.php';
use Symfony\Components\CLI\Input\ArrayInput;
use Symfony\Components\CLI\Input\Definition;
use Symfony\Components\CLI\Input\Argument;
use Symfony\Components\CLI\Input\Option;
$t = new LimeTest(19);
// __construct()
$t->diag('__construct()');
$input = new ArrayInput(array('name' => 'foo'), new Definition(array(new Argument('name'))));
$t->is($input->getArgument('name'), 'foo', '->__construct() takes a Definition as an argument');
// ->getOption() ->setOption() ->getOptions()
$t->diag('->getOption() ->setOption() ->getOptions()');
$input = new ArrayInput(array('--name' => 'foo'), new Definition(array(new Option('name'))));
$t->is($input->getOption('name'), 'foo', '->getOption() returns the value for the given option');
$input->setOption('name', 'bar');
$t->is($input->getOption('name'), 'bar', '->setOption() sets the value for a given option');
$t->is($input->getOptions(), array('name' => 'bar'), '->getOptions() returns all option values');
$input = new ArrayInput(array('--name' => 'foo'), new Definition(array(new Option('name'), new Option('bar', '', Option::PARAMETER_OPTIONAL, '', 'default'))));
$t->is($input->getOption('bar'), 'default', '->getOption() returns the default value for optional options');
$t->is($input->getOptions(), array('name' => 'foo', 'bar' => 'default'), '->getOptions() returns all option values, even optional ones');
try {
    $input->setOption('foo', 'bar');
开发者ID:vjousse,项目名称:symfony,代码行数:31,代码来源:InputTest.php


示例11: realpath

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <[email protected]>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../bootstrap.php';
use Symfony\Components\DependencyInjection\Builder;
$fixturesPath = realpath(__DIR__ . '/../../../../fixtures/Symfony/Components/DependencyInjection/');
require_once $fixturesPath . '/includes/classes.php';
require_once $fixturesPath . '/includes/foo.php';
$t = new LimeTest(30);
// cross-check loaders/dumpers
$t->diag('cross-check loaders/dumpers');
$fixtures = array('services1.xml' => 'xml', 'services2.xml' => 'xml', 'services6.xml' => 'xml', 'services8.xml' => 'xml', 'services9.xml' => 'xml', 'services1.yml' => 'yaml', 'services2.yml' => 'yaml', 'services6.yml' => 'yaml', 'services8.yml' => 'yaml', 'services9.yml' => 'yaml');
foreach ($fixtures as $fixture => $type) {
    $loaderClass = 'Symfony\\Components\\DependencyInjection\\Loader\\' . ucfirst($type) . 'FileLoader';
    $dumperClass = 'Symfony\\Components\\DependencyInjection\\Dumper\\' . ucfirst($type) . 'Dumper';
    $container1 = new Builder();
    $loader1 = new $loaderClass($container1);
    $loader1->load($fixturesPath . '/' . $type . '/' . $fixture);
    $container1->setParameter('path', $fixturesPath . '/includes');
    $dumper = new $dumperClass($container1);
    $tmp = tempnam('sf_service_container', 'sf');
    file_put_contents($tmp, $dumper->dump());
    $container2 = new Builder();
    $loader2 = new $loaderClass($container2);
    $loader2->load($tmp);
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:31,代码来源:CrossCheckTest.php


示例12: LimeTest

<?php

/*
 * This file is part of the symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../../bootstrap.php';
use Symfony\Components\Templating\Helper\AssetsHelper;
$t = new LimeTest(25);
// __construct()
$t->diag('__construct()');
$helper = new AssetsHelper('foo', 'http://www.example.com', 'abcd');
$t->is($helper->getBasePath(), '/foo/', '__construct() takes a base path as its first argument');
$t->is($helper->getBaseURLs(), array('http://www.example.com'), '__construct() takes a base URL as its second argument');
$t->is($helper->getVersion(), 'abcd', '__construct() takes a version as its thrid argument');
// ->getBasePath() ->setBasePath()
$t->diag('->getBasePath() ->setBasePath()');
$helper = new AssetsHelper();
$helper->setBasePath('foo/');
$t->is($helper->getBasePath(), '/foo/', '->setBasePath() prepends a / if needed');
$helper->setBasePath('/foo');
$t->is($helper->getBasePath(), '/foo/', '->setBasePath() appends a / is needed');
$helper->setBasePath('');
$t->is($helper->getBasePath(), '/', '->setBasePath() returns / if no base path is defined');
$helper->setBasePath('0');
$t->is($helper->getBasePath(), '/0/', '->setBasePath() returns /0/ if 0 is given');
// ->getVersion() ->getVersion()
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:31,代码来源:AssetsTest.php


示例13: LimeTest

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <[email protected]>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../../bootstrap.php';
use Symfony\Components\Routing\Matcher\UrlMatcher;
use Symfony\Components\Routing\RouteCollection;
use Symfony\Components\Routing\Route;
$t = new LimeTest(1);
$collection = new RouteCollection();
$collection->addRoute('foo', new Route('/:foo'));
class UrlMatcherTest extends UrlMatcher
{
    public function normalizeUrl($url)
    {
        return parent::normalizeUrl($url);
    }
}
$matcher = new UrlMatcherTest($collection, array(), array());
// ->normalizeUrl()
$t->diag('->normalizeUrl()');
$t->is($matcher->normalizeUrl(''), '/', '->normalizeUrl() adds a / at the beginning of the URL if needed');
$t->is($matcher->normalizeUrl('foo'), '/foo', '->normalizeUrl() adds a / at the beginning of the URL if needed');
$t->is($matcher->normalizeUrl('/foo?foo=bar'), '/foo', '->normalizeUrl() removes the query string');
$t->is($matcher->normalizeUrl('/foo//bar'), '/foo/bar', '->normalizeUrl() removes duplicated /');
// ->match()
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:31,代码来源:UrlMatcherTest.php


示例14: LimeTest

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <[email protected]>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

require_once __DIR__.'/../../../../bootstrap.php';

use Symfony\Components\DependencyInjection\Builder;
use Symfony\Components\DependencyInjection\Loader\IniFileLoader;

$t = new LimeTest(3);

$fixturesPath = realpath(__DIR__.'/../../../../../fixtures/Symfony/Components/DependencyInjection/');

$loader = new IniFileLoader($fixturesPath.'/ini');
$config = $loader->load('parameters.ini');
$t->is($config->getParameters(), array('foo' => 'bar', 'bar' => '%foo%'), '->load() takes a single file name as its first argument');

try
{
  $loader->load('foo.ini');
  $t->fail('->load() throws an InvalidArgumentException if the loaded file does not exist');
}
catch (InvalidArgumentException $e)
{
  $t->pass('->load() throws an InvalidArgumentException if the loaded file does not exist');
开发者ID:nicolasmartin,项目名称:symfony,代码行数:31,代码来源:IniLoaderTest.php


示例15: LimeTest

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../../bootstrap.php';
use Symfony\Components\CLI\Tester\CommandTester;
use Symfony\Components\CLI\Application;
$t = new LimeTest(2);
$application = new Application();
// ->execute()
$t->diag('->execute()');
$commandTester = new CommandTester($application->getCommand('list'));
$commandTester->execute(array());
$t->like($commandTester->getDisplay(), '/help   Displays help for a command/', '->execute() returns a list of available commands');
$commandTester->execute(array('--xml' => true));
$t->like($commandTester->getDisplay(), '/<command id="list" namespace="_global" name="list">/', '->execute() returns a list of available commands in XML if --xml is passed');
开发者ID:vjousse,项目名称:symfony,代码行数:21,代码来源:ListCommandTest.php


示例16: LimeTest

 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

require_once __DIR__.'/../../../../bootstrap.php';

use Symfony\Components\Console\Input\InputDefinition;
use Symfony\Components\Console\Input\InputArgument;
use Symfony\Components\Console\Input\InputOption;
use Symfony\Components\Console\Exception;

$fixtures = __DIR__.'/../../../../../fixtures/Symfony/Components/Console';

$t = new LimeTest(51);

$foo = new InputArgument('foo');
$bar = new InputArgument('bar');
$foo1 = new InputArgument('foo');
$foo2 = new InputArgument('foo2', InputArgument::REQUIRED);

// __construct()
$t->diag('__construct()');
$definition = new InputDefinition();
$t->is($definition->getArguments(), array(), '__construct() creates a new InputDefinition object');

$definition = new InputDefinition(array($foo, $bar));
$t->is($definition->getArguments(), array('foo' => $foo, 'bar' => $bar), '__construct() takes an array of InputArgument objects as its first argument');

// ->setArguments()
开发者ID:nicolasmartin,项目名称:symfony,代码行数:31,代码来源:InputDefinitionTest.php


示例17: LimeTest

<?php

/*
 * This file is part of the symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

require_once __DIR__.'/../../../bootstrap.php';

use Symfony\Components\OutputEscaper\Escaper;

$t = new LimeTest(3);

class OutputEscaperTest
{
  public function __toString()
  {
    return $this->getTitle();
  }

  public function getTitle()
  {
    return '<strong>escaped!</strong>';
  }

  public function getTitles()
  {
开发者ID:nicolasmartin,项目名称:symfony,代码行数:31,代码来源:ObjectDecoratorTest.php


示例18: LimeTest

 * (c) Fabien Potencier <[email protected]>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

require_once __DIR__.'/../../../../bootstrap.php';

require_once __DIR__.'/../../../../../lib/SymfonyTests/Components/Templating/ProjectTemplateDebugger.php';

use Symfony\Components\Templating\Loader\Loader;
use Symfony\Components\Templating\Loader\CacheLoader;
use Symfony\Components\Templating\Loader\CompilableLoaderInterface;
use Symfony\Components\Templating\Storage\StringStorage;

$t = new LimeTest(9);

class ProjectTemplateLoader extends CacheLoader
{
  public function getDir()
  {
    return $this->dir;
  }

  public function getLoader()
  {
    return $this->loader;
  }
}

class ProjectTemplateLoaderVar extends Loader
开发者ID:nicolasmartin,项目名称:symfony,代码行数:31,代码来源:CacheLoaderTest.php


示例19: LimeTest

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../../bootstrap.php';
use Symfony\Components\CLI\Output\Formatter;
$t = new LimeTest(4);
// ::formatSection()
$t->diag('::formatSection()');
$t->is(Formatter::formatSection('cli', 'Some text to display'), '<info>[cli]</info> Some text to display', '::formatSection() formats a message in a section');
// ::formatBlock()
$t->diag('::formatBlock()');
$t->is(Formatter::formatBlock('Some text to display', 'error'), '<error> Some text to display </error>', '::formatBlock() formats a message in a block');
$t->is(Formatter::formatBlock(array('Some text to display', 'foo bar'), 'error'), "<error> Some text to display </error>\n<error> foo bar              </error>", '::formatBlock() formats a message in a block');
$t->is(Formatter::formatBlock('Some text to display', 'error', true), "<error>                        </error>\n<error>  Some text to display  </error>\n<error>                        </error>", '::formatBlock() formats a message in a block');
开发者ID:vjousse,项目名称:symfony,代码行数:20,代码来源:FormatterTest.php


示例20: dirname

<?php

/**
 * This file is part of the Sonata RESTful PHP framework
 * (c) 2009-2010 Pascal Cremer <[email protected]>
 *
 * @author Pascal Cremer <[email protected]>
 */
require_once dirname(__FILE__) . '/bootstrap.php';
$t = new LimeTest();
// @Test: ::camelize()
$t->is(Sonata_Utils::camelize('foo_bar_baz'), 'FooBarBaz', 'The string was camelized correctly');
$t->is(Sonata_Utils::camelize('foo_bar_baz', true), 'fooBarBaz', 'The string was camelized correctly, starting lower-case');
$t->is(Sonata_Utils::camelize('foo _ bar _baz'), 'FooBarBaz', 'Whitespaces are ignored');
$t->is(Sonata_Utils::camelize(''), '', 'Empty strings are retuned untouched');
// @Test: ::underscore()
$t->is(Sonata_Utils::underscore('FooBar'), 'foo_bar', 'The string was underscored correctly');
$t->is(Sonata_Utils::underscore('myFooBar'), 'my_foo_bar', 'It even works for camelized strings that start lower-case');
$t->is(Sonata_Utils::underscore('Foo Bar-!/#Baz'), 'foo_bar_baz', 'Whitespaces and non-digit characters are ignored');
$t->is(Sonata_Utils::underscore(''), '', 'Empty strings are retuned untouched');
// @Test: ::slugify()
$t->is(Sonata_Utils::slugify('Here be dragons!'), 'here-be-dragons', 'The string was slugified correctly');
$t->is(Sonata_Utils::slugify('Hérè be drägons!'), 'here-be-dragons', 'Transforms UTF-8 characters correctly');
$t->is(Sonata_Utils::slugify(''), 'n-a', '\'n-a\' is returned for empty strings');
开发者ID:b00giZm,项目名称:sonata-framework,代码行数:24,代码来源:Sonata_UtilsTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Line类代码示例发布时间:2022-05-23
下一篇:
PHP LimeExpressionManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap