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


PHP LimeTest::diag方法代码示例

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


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

示例1: dirname

<?php

/*
 * This file is part of Twig.
 *
 * (c) Fabien Potencier
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../lib/lime/LimeAutoloader.php';
LimeAutoloader::register();
require_once dirname(__FILE__) . '/../../../lib/Twig/Autoloader.php';
Twig_Autoloader::register();
$t = new LimeTest(3);
// ->autoload()
$t->diag('->autoload()');
$t->ok(!class_exists('Foo'), '->autoload() does not try to load classes that does not begin with Twig');
$autoloader = new Twig_Autoloader();
$t->is($autoloader->autoload('Twig_Parser'), true, '->autoload() returns true if it is able to load a class');
$t->is($autoloader->autoload('Foo'), false, '->autoload() returns false if it is not able to load a class');
开发者ID:vtprepo,项目名称:Twig,代码行数:21,代码来源:AutoloaderTest.php

示例2: LimeTest

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * 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

示例3: LimeTest

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * 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\EventDispatcher\Event;
use Symfony\Components\EventDispatcher\EventDispatcher;
$t = new LimeTest(19);
$dispatcher = new EventDispatcher();
// ->connect() ->disconnect()
$t->diag('->connect() ->disconnect()');
$dispatcher->connect('bar', 'listenToBar');
$t->is($dispatcher->getListeners('bar'), array('listenToBar'), '->connect() connects a listener to an event name');
$dispatcher->connect('bar', 'listenToBarBar');
$t->is($dispatcher->getListeners('bar'), array('listenToBar', 'listenToBarBar'), '->connect() can connect several listeners for the same event name');
$dispatcher->connect('barbar', 'listenToBarBar');
$dispatcher->disconnect('bar', 'listenToBarBar');
$t->is($dispatcher->getListeners('bar'), array('listenToBar'), '->disconnect() disconnects a listener for an event name');
$t->is($dispatcher->getListeners('barbar'), array('listenToBarBar'), '->disconnect() disconnects a listener for an event name');
$t->ok($dispatcher->disconnect('foobar', 'listen') === false, '->disconnect() returns false if the listener does not exist');
// ->getListeners() ->hasListeners()
$t->diag('->getListeners() ->hasListeners()');
$t->is($dispatcher->hasListeners('foo'), false, '->hasListeners() returns false if the event has no listener');
$dispatcher->connect('foo', 'listenToFoo');
$t->is($dispatcher->hasListeners('foo'), true, '->hasListeners() returns true if the event has some listeners');
$dispatcher->disconnect('foo', 'listenToFoo');
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:31,代码来源:EventDispatcherTest.php

示例4: LimeTest

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * 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

示例5: LimeTest

 *
 * 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\Output\Output;
use Symfony\Components\Console\Output\StreamOutput;

$t = new LimeTest(5);

$stream = fopen('php://memory', 'a', false);

// __construct()
$t->diag('__construct()');

try
{
  $output = new StreamOutput('foo');
  $t->fail('__construct() throws an \InvalidArgumentException if the first argument is not a stream');
}
catch (\InvalidArgumentException $e)
{
  $t->pass('__construct() throws an \InvalidArgumentException if the first argument is not a stream');
}

$output = new StreamOutput($stream, Output::VERBOSITY_QUIET, true);
$t->is($output->getVerbosity(), Output::VERBOSITY_QUIET, '__construct() takes the verbosity as its first argument');
$t->is($output->isDecorated(), true, '__construct() takes the decorated flag as its second argument');
开发者ID:nicolasmartin,项目名称:symfony,代码行数:30,代码来源:StreamOutputTest.php

示例6: LimeTest

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 * 
 * 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\BuilderConfiguration;
use Symfony\Components\DependencyInjection\Definition;
use Symfony\Components\DependencyInjection\Reference;
$fixturesPath = __DIR__ . '/../../../../fixtures/Symfony/Components/DependencyInjection/';
$t = new LimeTest(61);
// ->setDefinitions() ->addDefinitions() ->getDefinitions() ->setDefinition() ->getDefinition() ->hasDefinition()
$t->diag('->setDefinitions() ->addDefinitions() ->getDefinitions() ->setDefinition() ->getDefinition() ->hasDefinition()');
$builder = new Builder();
$definitions = array('foo' => new Definition('FooClass'), 'bar' => new Definition('BarClass'));
$builder->setDefinitions($definitions);
$t->is($builder->getDefinitions(), $definitions, '->setDefinitions() sets the service definitions');
$t->ok($builder->hasDefinition('foo'), '->hasDefinition() returns true if a service definition exists');
$t->ok(!$builder->hasDefinition('foobar'), '->hasDefinition() returns false if a service definition does not exist');
$builder->setDefinition('foobar', $foo = new Definition('FooBarClass'));
$t->is($builder->getDefinition('foobar'), $foo, '->getDefinition() returns a service definition if defined');
$t->ok($builder->setDefinition('foobar', $foo = new Definition('FooBarClass')) === $foo, '->setDefinition() implements a fuild interface by returning the service reference');
$builder->addDefinitions($defs = array('foobar' => new Definition('FooBarClass')));
$t->is($builder->getDefinitions(), array_merge($definitions, $defs), '->addDefinitions() adds the service definitions');
try {
    $builder->getDefinition('baz');
    $t->fail('->getDefinition() throws an InvalidArgumentException if the service definition does not exist');
} catch (InvalidArgumentException $e) {
开发者ID:pablosik,项目名称:symfony,代码行数:31,代码来源:BuilderTest.php

示例7: LimeTest

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()
$t->diag('->setArguments()');
$definition = new InputDefinition();
$definition->setArguments(array($foo));
$t->is($definition->getArguments(), array('foo' => $foo), '->setArguments() sets the array of InputArgument objects');
$definition->setArguments(array($bar));

$t->is($definition->getArguments(), array('bar' => $bar), '->setArguments() clears all InputArgument objects');
开发者ID:nicolasmartin,项目名称:symfony,代码行数:30,代码来源:InputDefinitionTest.php

示例8: LimeTest

 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * 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\Parser;
use Symfony\Components\Yaml\ParserException;
Yaml::setSpecVersion('1.1');
$t = new LimeTest(148);
$parser = new Parser();
$path = __DIR__ . '/../../../../fixtures/Symfony/Components/Yaml';
$files = $parser->parse(file_get_contents($path . '/index.yml'));
foreach ($files as $file) {
    $t->diag($file);
    $yamls = file_get_contents($path . '/' . $file . '.yml');
    // split YAMLs documents
    foreach (preg_split('/^---( %YAML\\:1\\.0)?/m', $yamls) as $yaml) {
        if (!$yaml) {
            continue;
        }
        $test = $parser->parse($yaml);
        if (isset($test['todo']) && $test['todo']) {
            $t->todo($test['test']);
        } else {
            $expected = var_export(eval('return ' . trim($test['php']) . ';'), true);
            $t->is(var_export($parser->parse($test['yaml']), true), $expected, $test['test']);
        }
    }
}
开发者ID:pablosik,项目名称:symfony,代码行数:31,代码来源:ParserTest.php

示例9: getFilesAsXml

use Symfony\Components\DependencyInjection\Reference;
use Symfony\Components\DependencyInjection\Definition;
use Symfony\Components\DependencyInjection\Loader\Loader;
use Symfony\Components\DependencyInjection\Loader\XmlFileLoader;
$t = new LimeTest(44);
$fixturesPath = realpath(__DIR__ . '/../../../../../fixtures/Symfony/Components/DependencyInjection/');
require_once $fixturesPath . '/includes/ProjectExtension.php';
class ProjectLoader extends XmlFileLoader
{
    public function getFilesAsXml(array $files)
    {
        return parent::getFilesAsXml($files);
    }
}
// ->getFilesAsXml()
$t->diag('->getFilesAsXml()');
$loader = new ProjectLoader($fixturesPath . '/ini');
try {
    $loader->getFilesAsXml(array('foo.xml'));
    $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');
}
try {
    $loader->getFilesAsXml(array('parameters.ini'));
    $t->fail('->load() throws an InvalidArgumentException if the loaded file is not a valid XML file');
} catch (InvalidArgumentException $e) {
    $t->pass('->load() throws an InvalidArgumentException if the loaded file is not a valid XML file');
}
$loader = new ProjectLoader($fixturesPath . '/xml');
try {
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:31,代码来源:XmlFileLoaderTest.php

示例10: getContent

 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 * 
 * 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\Storage\Storage;
use Symfony\Components\Templating\Renderer\PhpRenderer;

$t = new LimeTest(2);

class TestStorage extends Storage
{
  public function getContent()
  {
  }
}

// __construct() __toString()
$t->diag('__construct() __toString()');

$storage = new TestStorage('foo');
$t->is((string) $storage, 'foo', '__toString() returns the template name');

// ->getRenderer()
$t->diag('->getRenderer()');
$storage = new TestStorage('foo', $renderer = new PhpRenderer());
$t->ok($storage->getRenderer() === $renderer, '->getRenderer() returns the renderer');
开发者ID:nicolasmartin,项目名称:symfony,代码行数:30,代码来源:StorageTest.php

示例11: LimeTest

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 * 
 * 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\Reference;
$t = new LimeTest(1);
// __construct() ->__toString()
$t->diag('__construct() ->__toString()');
$ref = new Reference('foo');
$t->is((string) $ref, 'foo', '__construct() sets the id of the reference, which is used for the __toString() method');
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:16,代码来源:ReferenceTest.php

示例12: LimeTest

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 * 
 * 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\FileResource;
$t = new LimeTest(4);
// ->getResource()
$t->diag('->getResource()');
$file = sys_get_temp_dir() . '/tmp.xml';
touch($file);
$resource = new FileResource($file);
$t->is($resource->getResource(), $file, '->getResource() returns the path to the resource');
// ->isUptodate()
$t->diag('->isUptodate()');
$t->ok($resource->isUptodate(time() + 10), '->isUptodate() returns true if the resource has not changed');
$t->ok(!$resource->isUptodate(time() - 86400), '->isUptodate() returns false if the resource has been updated');
unlink($file);
$resource = new FileResource('/____foo/foobar' . rand(1, 999999));
$t->ok(!$resource->isUptodate(time()), '->isUptodate() returns false if the resource does not exist');
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:25,代码来源:FileResourceTest.php

示例13: LimeTest

use Symfony\Components\Console\Input\StringInput;
use Symfony\Components\Console\Output\OutputInterface;
use Symfony\Components\Console\Output\NullOutput;
use Symfony\Components\Console\Output\StreamOutput;
use Symfony\Components\Console\Tester\CommandTester;

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

$t = new LimeTest(46);

require_once $fixtures.'/TestCommand.php';

$application = new Application();

// __construct()
$t->diag('__construct()');
try
{
  $command = new Command();
  $t->fail('__construct() throws a \LogicException if the name is null');
}
catch (\LogicException $e)
{
  $t->pass('__construct() throws a \LogicException if the name is null');
}
$command = new Command('foo:bar');
$t->is($command->getFullName(), 'foo:bar', '__construct() takes the command name as its first argument');

// ->setApplication()
$t->diag('->setApplication()');
$command = new TestCommand();
开发者ID:nicolasmartin,项目名称:symfony,代码行数:31,代码来源:CommandTest.php

示例14: load

<?php

/*
 * This file is part of the symfony package.
 *
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 * 
 * 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;
$t = new LimeTest(1);
class ProjectTemplateLoader extends Loader
{
    public function load($template, $renderer = 'php')
    {
    }
    public function getDebugger()
    {
        return $this->debugger;
    }
}
// ->setDebugger()
$t->diag('->setDebugger()');
$loader = new ProjectTemplateLoader();
$loader->setDebugger($debugger = new ProjectTemplateDebugger());
$t->ok($loader->getDebugger() === $debugger, '->setDebugger() sets the debugger instance');
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:29,代码来源:LoaderTest.php

示例15: getTemplatePathPatterns

class ProjectTemplateLoader extends FilesystemLoader
{
  public function getTemplatePathPatterns()
  {
    return $this->templatePathPatterns;
  }

  static public function isAbsolutePath($path)
  {
    return parent::isAbsolutePath($path);
  }
}

// ->isAbsolutePath()
$t->diag('->isAbsolutePath()');
$t->ok(ProjectTemplateLoader::isAbsolutePath('/foo.xml'), '->isAbsolutePath() returns true if the path is an absolute path');
$t->ok(ProjectTemplateLoader::isAbsolutePath('c:\\\\foo.xml'), '->isAbsolutePath() returns true if the path is an absolute path');
$t->ok(ProjectTemplateLoader::isAbsolutePath('c:/foo.xml'), '->isAbsolutePath() returns true if the path is an absolute path');
$t->ok(ProjectTemplateLoader::isAbsolutePath('\\server\\foo.xml'), '->isAbsolutePath() returns true if the path is an absolute path');

// __construct()
$t->diag('__construct()');
$pathPattern = $fixturesPath.'/templates/%name%.%renderer%';
$path = $fixturesPath.'/templates';
$loader = new ProjectTemplateLoader($pathPattern);
$t->is($loader->getTemplatePathPatterns(), array($pathPattern), '__construct() takes a path as its second argument');
$loader = new ProjectTemplateLoader(array($pathPattern));
$t->is($loader->getTemplatePathPatterns(), array($pathPattern), '__construct() takes an array of paths as its second argument');

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


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