replaced assertType by the new assertInstanceOf in unit tests

This commit is contained in:
pborreli 2010-04-25 14:04:09 +00:00 committed by Fabien Potencier
parent 9eb3607edf
commit 7065957a30
33 changed files with 113 additions and 113 deletions

View File

@ -111,7 +111,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->getCommand() throws an \InvalidArgumentException if the command does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->getCommand() throws an \InvalidArgumentException if the command does not exist');
$this->assertEquals('The command "foofoo" does not exist.', $e->getMessage(), '->getCommand() throws an \InvalidArgumentException if the command does not exist');
}
@ -145,7 +145,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->findNamespace() throws an \InvalidArgumentException if the abbreviation is ambiguous');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->findNamespace() throws an \InvalidArgumentException if the abbreviation is ambiguous');
$this->assertEquals('The namespace "f" is ambiguous (foo, foo1).', $e->getMessage(), '->findNamespace() throws an \InvalidArgumentException if the abbreviation is ambiguous');
}
@ -156,7 +156,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->findNamespace() throws an \InvalidArgumentException if no command is in the given namespace');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->findNamespace() throws an \InvalidArgumentException if no command is in the given namespace');
$this->assertEquals('There are no commands defined in the "bar" namespace.', $e->getMessage(), '->findNamespace() throws an \InvalidArgumentException if no command is in the given namespace');
}
}
@ -181,7 +181,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace');
$this->assertEquals('Command "f" is not defined.', $e->getMessage(), '->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace');
}
@ -192,7 +192,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias');
$this->assertEquals('Command "a" is ambiguous (afoobar, afoobar1 and 1 more).', $e->getMessage(), '->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias');
}
@ -203,7 +203,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command');
$this->assertEquals('Command "foo:b" is ambiguous (foo:bar, foo:bar1).', $e->getMessage(), '->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command');
}
}
@ -226,7 +226,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '->setCatchExceptions() sets the catch exception flag');
$this->assertInstanceOf('\Exception', $e, '->setCatchExceptions() sets the catch exception flag');
$this->assertEquals('Command "foo" is not defined.', $e->getMessage(), '->setCatchExceptions() sets the catch exception flag');
}
}

View File

@ -43,7 +43,7 @@ class CommandTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\LogicException', $e, '__construct() throws a \LogicException if the name is null');
$this->assertInstanceOf('\LogicException', $e, '__construct() throws a \LogicException if the name is null');
$this->assertEquals('The command name cannot be empty.', $e->getMessage(), '__construct() throws a \LogicException if the name is null');
}
$command = new Command('foo:bar');
@ -111,7 +111,7 @@ class CommandTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->setName() throws an \InvalidArgumentException if the name is empty');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->setName() throws an \InvalidArgumentException if the name is empty');
$this->assertEquals('A command name cannot be empty.', $e->getMessage(), '->setName() throws an \InvalidArgumentException if the name is empty');
}
@ -122,7 +122,7 @@ class CommandTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->setName() throws an \InvalidArgumentException if the name is empty');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->setName() throws an \InvalidArgumentException if the name is empty');
$this->assertEquals('A command name cannot be empty.', $e->getMessage(), '->setName() throws an \InvalidArgumentException if the name is empty');
}
}
@ -214,7 +214,7 @@ class CommandTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->run() throws a \InvalidArgumentException when the input does not validate the current InputDefinition');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->run() throws a \InvalidArgumentException when the input does not validate the current InputDefinition');
$this->assertEquals('The "--bar" option does not exist.', $e->getMessage(), '->run() throws a \InvalidArgumentException when the input does not validate the current InputDefinition');
}
@ -229,7 +229,7 @@ class CommandTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\LogicException', $e, '->run() throws a \LogicException if the execute() method has not been overriden and no code has been provided');
$this->assertInstanceOf('\LogicException', $e, '->run() throws a \LogicException if the execute() method has not been overriden and no code has been provided');
$this->assertEquals('You must override the execute() method in the concrete command class.', $e->getMessage(), '->run() throws a \LogicException if the execute() method has not been overriden and no code has been provided');
}
}

View File

@ -53,7 +53,7 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\RuntimeException', $e, '->parse() throws a \RuntimeException if no parameter is passed to an option when it is required');
$this->assertInstanceOf('\RuntimeException', $e, '->parse() throws a \RuntimeException if no parameter is passed to an option when it is required');
$this->assertEquals('The "--foo" option requires a value.', $e->getMessage(), '->parse() throws a \RuntimeException if no parameter is passed to an option when it is required');
}
@ -81,7 +81,7 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\RuntimeException', $e, '->parse() throws a \RuntimeException if no parameter is passed to an option when it is required');
$this->assertInstanceOf('\RuntimeException', $e, '->parse() throws a \RuntimeException if no parameter is passed to an option when it is required');
$this->assertEquals('The "--foo" option requires a value.', $e->getMessage(), '->parse() throws a \RuntimeException if no parameter is passed to an option when it is required');
}
@ -93,7 +93,7 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\RuntimeException', $e, '->parse() throws a \RuntimeException if a value is passed to an option which does not take one');
$this->assertInstanceOf('\RuntimeException', $e, '->parse() throws a \RuntimeException if a value is passed to an option which does not take one');
$this->assertEquals('The "-o" option does not exist.', $e->getMessage(), '->parse() throws a \RuntimeException if a value is passed to an option which does not take one');
}
@ -105,7 +105,7 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\RuntimeException', $e, '->parse() throws a \RuntimeException if too many arguments are passed');
$this->assertInstanceOf('\RuntimeException', $e, '->parse() throws a \RuntimeException if too many arguments are passed');
$this->assertEquals('Too many arguments.', $e->getMessage(), '->parse() throws a \RuntimeException if too many arguments are passed');
}
@ -117,7 +117,7 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\RuntimeException', $e, '->parse() throws a \RuntimeException if an unknown long option is passed');
$this->assertInstanceOf('\RuntimeException', $e, '->parse() throws a \RuntimeException if an unknown long option is passed');
$this->assertEquals('The "--foo" option does not exist.', $e->getMessage(), '->parse() throws a \RuntimeException if an unknown long option is passed');
}
@ -129,7 +129,7 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\RuntimeException', $e, '->parse() throws a \RuntimeException if an unknown short option is passed');
$this->assertInstanceOf('\RuntimeException', $e, '->parse() throws a \RuntimeException if an unknown short option is passed');
$this->assertEquals('The "-f" option does not exist.', $e->getMessage(), '->parse() throws a \RuntimeException if an unknown short option is passed');
}

View File

@ -49,7 +49,7 @@ class ArrayInputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->parse() throws an \InvalidArgumentException exception if an invalid argument is passed');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->parse() throws an \InvalidArgumentException exception if an invalid argument is passed');
$this->assertEquals('The "foo" argument does not exist.', $e->getMessage(), '->parse() throws an \InvalidArgumentException exception if an invalid argument is passed');
}
@ -69,7 +69,7 @@ class ArrayInputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->parse() throws an \InvalidArgumentException exception if a required option is passed without a value');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->parse() throws an \InvalidArgumentException exception if a required option is passed without a value');
$this->assertEquals('The "--foo" option requires a value.', $e->getMessage(), '->parse() throws an \InvalidArgumentException exception if a required option is passed without a value');
}
@ -80,7 +80,7 @@ class ArrayInputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->parse() throws an \InvalidArgumentException exception if an invalid option is passed');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->parse() throws an \InvalidArgumentException exception if an invalid option is passed');
$this->assertEquals('The "--foo" option does not exist.', $e->getMessage(), '->parse() throws an \InvalidArgumentException exception if an invalid option is passed');
}
@ -94,7 +94,7 @@ class ArrayInputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->parse() throws an \InvalidArgumentException exception if an invalid option is passed');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->parse() throws an \InvalidArgumentException exception if an invalid option is passed');
$this->assertEquals('The "-o" option does not exist.', $e->getMessage(), '->parse() throws an \InvalidArgumentException exception if an invalid option is passed');
}
}

View File

@ -40,7 +40,7 @@ class InputArgumentTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '__construct() throws an Exception if the mode is not valid');
$this->assertInstanceOf('\Exception', $e, '__construct() throws an Exception if the mode is not valid');
$this->assertEquals('Argument mode "ANOTHER_ONE" is not valid.', $e->getMessage());
}
}
@ -87,7 +87,7 @@ class InputArgumentTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '->parse() throws an \InvalidArgumentException exception if an invalid option is passed');
$this->assertInstanceOf('\Exception', $e, '->parse() throws an \InvalidArgumentException exception if an invalid option is passed');
$this->assertEquals('Cannot set a default value except for Parameter::OPTIONAL mode.', $e->getMessage());
}
@ -99,7 +99,7 @@ class InputArgumentTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '->setDefault() throws an Exception if you give a default value which is not an array for a IS_ARRAY option');
$this->assertInstanceOf('\Exception', $e, '->setDefault() throws an Exception if you give a default value which is not an array for a IS_ARRAY option');
$this->assertEquals('A default value for an array argument must be an array.', $e->getMessage());
}
}

View File

@ -86,7 +86,7 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '->addArgument() throws a Exception if another argument is already registered with the same name');
$this->assertInstanceOf('\Exception', $e, '->addArgument() throws a Exception if another argument is already registered with the same name');
$this->assertEquals('An argument with name "foo" already exist.', $e->getMessage());
}
@ -99,7 +99,7 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '->addArgument() throws a Exception if there is an array parameter already registered');
$this->assertInstanceOf('\Exception', $e, '->addArgument() throws a Exception if there is an array parameter already registered');
$this->assertEquals('Cannot add an argument after an array argument.', $e->getMessage());
}
@ -114,7 +114,7 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '->addArgument() throws an exception if you try to add a required argument after an optional one');
$this->assertInstanceOf('\Exception', $e, '->addArgument() throws an exception if you try to add a required argument after an optional one');
$this->assertEquals('Cannot add a required argument after an optional one.', $e->getMessage());
}
}
@ -133,7 +133,7 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '->getArgument() throws an exception if the InputArgument name does not exist');
$this->assertInstanceOf('\Exception', $e, '->getArgument() throws an exception if the InputArgument name does not exist');
$this->assertEquals('The "bar" argument does not exist.', $e->getMessage());
}
}
@ -201,7 +201,7 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '->setOptions() clears all InputOption objects');
$this->assertInstanceOf('\Exception', $e, '->setOptions() clears all InputOption objects');
$this->assertEquals('The "-f" option does not exist.', $e->getMessage());
}
}
@ -232,7 +232,7 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '->addOption() throws a Exception if the another option is already registered with the same name');
$this->assertInstanceOf('\Exception', $e, '->addOption() throws a Exception if the another option is already registered with the same name');
$this->assertEquals('An option named "foo" already exist.', $e->getMessage());
}
try
@ -242,7 +242,7 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '->addOption() throws a Exception if the another option is already registered with the same shortcut');
$this->assertInstanceOf('\Exception', $e, '->addOption() throws a Exception if the another option is already registered with the same shortcut');
$this->assertEquals('An option with shortcut "f" already exist.', $e->getMessage());
}
}
@ -260,7 +260,7 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '->getOption() throws an exception if the option name does not exist');
$this->assertInstanceOf('\Exception', $e, '->getOption() throws an exception if the option name does not exist');
$this->assertEquals('The "--bar" option does not exist.', $e->getMessage());
}
}
@ -296,7 +296,7 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '->getOption() throws an exception if the shortcut does not exist');
$this->assertInstanceOf('\Exception', $e, '->getOption() throws an exception if the shortcut does not exist');
$this->assertEquals('The "-l" option does not exist.', $e->getMessage());
}
}

View File

@ -29,7 +29,7 @@ class InputOptionTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '->setDefault() throws an Exception if PARAMETER_IS_ARRAY option is used when an option does not accept a value');
$this->assertInstanceOf('\Exception', $e, '->setDefault() throws an Exception if PARAMETER_IS_ARRAY option is used when an option does not accept a value');
$this->assertEquals('Impossible to have an option mode PARAMETER_IS_ARRAY if the option does not accept a parameter.', $e->getMessage());
}
@ -72,7 +72,7 @@ class InputOptionTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '__construct() throws an Exception if the mode is not valid');
$this->assertInstanceOf('\Exception', $e, '__construct() throws an Exception if the mode is not valid');
$this->assertEquals('Option mode "ANOTHER_ONE" is not valid.', $e->getMessage());
}
}
@ -129,7 +129,7 @@ class InputOptionTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '->setDefault() throws an Exception if you give a default value for a PARAMETER_NONE option');
$this->assertInstanceOf('\Exception', $e, '->setDefault() throws an Exception if you give a default value for a PARAMETER_NONE option');
$this->assertEquals('Cannot set a default value when using Option::PARAMETER_NONE mode.', $e->getMessage());
}
@ -141,7 +141,7 @@ class InputOptionTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, '->setDefault() throws an Exception if you give a default value which is not an array for a PARAMETER_IS_ARRAY option');
$this->assertInstanceOf('\Exception', $e, '->setDefault() throws an Exception if you give a default value which is not an array for a PARAMETER_IS_ARRAY option');
$this->assertEquals('A default value for an array option must be an array.', $e->getMessage());
}
}

View File

@ -43,7 +43,7 @@ class InputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->setOption() throws a \InvalidArgumentException if the option does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->setOption() throws a \InvalidArgumentException if the option does not exist');
$this->assertEquals('The "foo" option does not exist.', $e->getMessage());
}
@ -54,7 +54,7 @@ class InputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->setOption() throws a \InvalidArgumentException if the option does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->setOption() throws a \InvalidArgumentException if the option does not exist');
$this->assertEquals('The "foo" option does not exist.', $e->getMessage());
}
}
@ -79,7 +79,7 @@ class InputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->setOption() throws a \InvalidArgumentException if the option does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->setOption() throws a \InvalidArgumentException if the option does not exist');
$this->assertEquals('The "foo" argument does not exist.', $e->getMessage());
}
@ -90,7 +90,7 @@ class InputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->setOption() throws a \InvalidArgumentException if the option does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->setOption() throws a \InvalidArgumentException if the option does not exist');
$this->assertEquals('The "foo" argument does not exist.', $e->getMessage());
}
}
@ -107,7 +107,7 @@ class InputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\RuntimeException', $e, '->validate() throws a \RuntimeException if not enough arguments are given');
$this->assertInstanceOf('\RuntimeException', $e, '->validate() throws a \RuntimeException if not enough arguments are given');
$this->assertEquals('Not enough arguments.', $e->getMessage());
}

View File

@ -76,7 +76,7 @@ class OutputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->writeln() throws an \InvalidArgumentException when the type does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->writeln() throws an \InvalidArgumentException when the type does not exist');
$this->assertEquals('Unknown output type given (24)', $e->getMessage());
}
@ -87,7 +87,7 @@ class OutputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->writeln() throws an \InvalidArgumentException when a style does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->writeln() throws an \InvalidArgumentException when a style does not exist');
$this->assertEquals('Unknown style "bar".', $e->getMessage());
}
}

View File

@ -31,7 +31,7 @@ class StreamOutputTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the first argument is not a stream');
$this->assertInstanceOf('\InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the first argument is not a stream');
$this->assertEquals('The StreamOutput class needs a stream as its first argument.', $e->getMessage());
}

View File

@ -45,7 +45,7 @@ class ParserTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Symfony\Components\CssSelector\SyntaxError', $e, '->parse() throws an Exception if the css selector is not valid');
$this->assertInstanceOf('\Symfony\Components\CssSelector\SyntaxError', $e, '->parse() throws an Exception if the css selector is not valid');
$this->assertEquals("Expected symbol, got '' at h1: -> ", $e->getMessage(), '->parse() throws an Exception if the css selector is not valid');
}
}

View File

@ -112,7 +112,7 @@ class BuilderConfigurationTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->getParameter() throws an \InvalidArgumentException if the key does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->getParameter() throws an \InvalidArgumentException if the key does not exist');
$this->assertEquals('The parameter "baba" must be defined.', $e->getMessage(), '->getParameter() throws an \InvalidArgumentException if the key does not exist');
}
}
@ -149,7 +149,7 @@ class BuilderConfigurationTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->getAlias() throws an \InvalidArgumentException if the alias does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->getAlias() throws an \InvalidArgumentException if the alias does not exist');
$this->assertEquals('The service alias "baba" does not exist.', $e->getMessage(), '->getAlias() throws an \InvalidArgumentException if the alias does not exist');
}
@ -186,7 +186,7 @@ class BuilderConfigurationTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->getDefinition() throws an InvalidArgumentException if the service definition does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->getDefinition() throws an InvalidArgumentException if the service definition does not exist');
$this->assertEquals('The service definition "baz" does not exist.', $e->getMessage(), '->getDefinition() throws an InvalidArgumentException if the service definition does not exist');
}
}

View File

@ -50,7 +50,7 @@ class BuilderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->getDefinition() throws an InvalidArgumentException if the service definition does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->getDefinition() throws an InvalidArgumentException if the service definition does not exist');
$this->assertEquals('The service definition "baz" does not exist.', $e->getMessage(), '->getDefinition() throws an InvalidArgumentException if the service definition does not exist');
}
}
@ -60,7 +60,7 @@ class BuilderTest extends \PHPUnit_Framework_TestCase
$builder = new Builder();
$builder->register('foo', 'FooClass');
$this->assertTrue($builder->hasDefinition('foo'), '->register() registers a new service definition');
$this->assertType('Symfony\Components\DependencyInjection\Definition', $builder->getDefinition('foo'), '->register() returns the newly created Definition instance');
$this->assertInstanceOf('Symfony\Components\DependencyInjection\Definition', $builder->getDefinition('foo'), '->register() returns the newly created Definition instance');
}
public function testHasService()
@ -83,7 +83,7 @@ class BuilderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->getService() throws an InvalidArgumentException if the service does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->getService() throws an InvalidArgumentException if the service does not exist');
$this->assertEquals('The service definition "foo" does not exist.', $e->getMessage(), '->getService() throws an InvalidArgumentException if the service does not exist');
}
$builder->register('foo', 'stdClass');
@ -101,7 +101,7 @@ class BuilderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\LogicException', $e, '->getService() throws a LogicException if the service has a circular reference to itself');
$this->assertInstanceOf('\LogicException', $e, '->getService() throws a LogicException if the service has a circular reference to itself');
$this->assertEquals('The service "baz" has a circular reference to itself.', $e->getMessage(), '->getService() throws a LogicException if the service has a circular reference to itself');
}
@ -136,7 +136,7 @@ class BuilderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->getAlias() throws an InvalidArgumentException if the alias does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->getAlias() throws an InvalidArgumentException if the alias does not exist');
$this->assertEquals('The service alias "foobar" does not exist.', $e->getMessage(), '->getAlias() throws an InvalidArgumentException if the alias does not exist');
}
}
@ -157,10 +157,10 @@ class BuilderTest extends \PHPUnit_Framework_TestCase
{
$builder = new Builder();
$builder->register('foo1', 'FooClass')->setFile(self::$fixturesPath.'/includes/foo.php');
$this->assertType('\FooClass', $builder->getService('foo1'), '->createService() requires the file defined by the service definition');
$this->assertInstanceOf('\FooClass', $builder->getService('foo1'), '->createService() requires the file defined by the service definition');
$builder->register('foo2', 'FooClass')->setFile(self::$fixturesPath.'/includes/%file%.php');
$builder->setParameter('file', 'foo');
$this->assertType('\FooClass', $builder->getService('foo2'), '->createService() replaces parameters in the file provided by the service definition');
$this->assertInstanceOf('\FooClass', $builder->getService('foo2'), '->createService() replaces parameters in the file provided by the service definition');
}
public function testCreateServiceClass()
@ -168,7 +168,7 @@ class BuilderTest extends \PHPUnit_Framework_TestCase
$builder = new Builder();
$builder->register('foo1', '%class%');
$builder->setParameter('class', 'stdClass');
$this->assertType('\stdClass', $builder->getService('foo1'), '->createService() replaces parameters in the class provided by the service definition');
$this->assertInstanceOf('\stdClass', $builder->getService('foo1'), '->createService() replaces parameters in the class provided by the service definition');
}
public function testCreateServiceArguments()
@ -223,7 +223,7 @@ class BuilderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->createService() throws an InvalidArgumentException if the configure callable is not a valid callable');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->createService() throws an InvalidArgumentException if the configure callable is not a valid callable');
$this->assertEquals('The configure callable for class "FooClass" is not a callable.', $e->getMessage(), '->createService() throws an InvalidArgumentException if the configure callable is not a valid callable');
}
}
@ -248,7 +248,7 @@ class BuilderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\RuntimeException', $e, '->resolveValue() throws a RuntimeException if a placeholder references a non-existant parameter');
$this->assertInstanceOf('\RuntimeException', $e, '->resolveValue() throws a RuntimeException if a placeholder references a non-existant parameter');
$this->assertEquals('The parameter "foobar" must be defined.', $e->getMessage(), '->resolveValue() throws a RuntimeException if a placeholder references a non-existant parameter');
}
@ -259,7 +259,7 @@ class BuilderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\RuntimeException', $e, '->resolveValue() throws a RuntimeException if a placeholder references a non-existant parameter');
$this->assertInstanceOf('\RuntimeException', $e, '->resolveValue() throws a RuntimeException if a placeholder references a non-existant parameter');
$this->assertEquals('The parameter "foobar" must be defined (used in the following expression: "foo %foobar% bar").', $e->getMessage(), '->resolveValue() throws a RuntimeException if a placeholder references a non-existant parameter');
}
}

View File

@ -66,7 +66,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->getParameter() thrown an \InvalidArgumentException if the key does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->getParameter() thrown an \InvalidArgumentException if the key does not exist');
$this->assertEquals('The parameter "baba" must be defined.', $e->getMessage(), '->getParameter() thrown an \InvalidArgumentException if the key does not exist');
}
@ -77,7 +77,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->offsetGet() thrown an \InvalidArgumentException if the key does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->offsetGet() thrown an \InvalidArgumentException if the key does not exist');
$this->assertEquals('The parameter "baba" must be defined.', $e->getMessage(), '->offsetGet() thrown an \InvalidArgumentException if the key does not exist');
}
}
@ -139,7 +139,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->getService() thrown an \InvalidArgumentException if the service does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->getService() thrown an \InvalidArgumentException if the service does not exist');
$this->assertEquals('The service "baba" does not exist.', $e->getMessage(), '->getService() thrown an \InvalidArgumentException if the service does not exist');
}
@ -150,7 +150,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->__get() thrown an \InvalidArgumentException if the service does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->__get() thrown an \InvalidArgumentException if the service does not exist');
$this->assertEquals('The service "baba" does not exist.', $e->getMessage(), '->__get() thrown an \InvalidArgumentException if the service does not exist');
}
@ -161,7 +161,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\LogicException', $e, '->__unset() thrown an LogicException if you try to remove a service');
$this->assertInstanceOf('\LogicException', $e, '->__unset() thrown an LogicException if you try to remove a service');
$this->assertEquals('You can\'t unset a service.', $e->getMessage(), '->__unset() thrown an LogicException if you try to remove a service');
}
@ -182,7 +182,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\BadMethodCallException', $e, '__call() throws a \BadMethodCallException exception if the method is not a service method');
$this->assertInstanceOf('\BadMethodCallException', $e, '__call() throws a \BadMethodCallException exception if the method is not a service method');
$this->assertEquals('Call to undefined method Symfony\Components\DependencyInjection\Container::getFooBar_Foo.', $e->getMessage(), '__call() throws a \BadMethodCallException exception if the method is not a service method');
}
}
@ -198,7 +198,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->getService() throws a \InvalidArgumentException exception if the service is empty');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->getService() throws a \InvalidArgumentException exception if the service is empty');
$this->assertEquals('The service "" does not exist.', $e->getMessage(), '->getService() throws a \InvalidArgumentException exception if the service is empty');
}
}

View File

@ -26,7 +26,7 @@ class DumperTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\LogicException', $e, '->dump() returns a LogicException if the dump() method has not been overriden by a children class');
$this->assertInstanceOf('\LogicException', $e, '->dump() returns a LogicException if the dump() method has not been overriden by a children class');
$this->assertEquals('You must extend this abstract class and implement the dump() method.', $e->getMessage(), '->dump() returns a LogicException if the dump() method has not been overriden by a children class');
}
}

View File

@ -55,7 +55,7 @@ class PhpDumperTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\RuntimeException', $e, '->dump() returns a LogicException if the dump() method has not been overriden by a children class');
$this->assertInstanceOf('\RuntimeException', $e, '->dump() returns a LogicException if the dump() method has not been overriden by a children class');
$this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() returns a LogicException if the dump() method has not been overriden by a children class');
}
}

View File

@ -54,7 +54,7 @@ class XmlDumperTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources');
$this->assertInstanceOf('\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources');
$this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources');
}
}

View File

@ -54,7 +54,7 @@ class YamlDumperTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources');
$this->assertInstanceOf('\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources');
$this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources');
}
}

View File

@ -35,7 +35,7 @@ class IniLoaderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not exist');
$this->assertStringStartsWith('The file "foo.ini" does not exist (in: ', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file does not exist');
}
@ -46,7 +46,7 @@ class IniLoaderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file is not parseable');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file is not parseable');
$this->assertEquals('The nonvalid.ini file is not valid.', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file is not parseable');
}
}

View File

@ -25,7 +25,7 @@ class LoaderExtensionTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tag does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tag does not exist');
$this->assertEquals('The tag "foo" is not defined in the "http://www.example.com/schema/project" extension.', $e->getMessage(), '->load() throws an InvalidArgumentException if the tag does not exist');
}

View File

@ -37,7 +37,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not exist');
$this->assertStringStartsWith('The file "foo.xml" does not exist (in:', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file does not exist');
}
}
@ -53,7 +53,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->parseFile() throws an InvalidArgumentException if the loaded file is not a valid XML file');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->parseFile() throws an InvalidArgumentException if the loaded file is not a valid XML file');
$this->assertStringStartsWith('[ERROR 4] Start tag expected, \'<\' not found (in', $e->getMessage(), '->parseFile() throws an InvalidArgumentException if the loaded file is not a valid XML file');
}
@ -66,7 +66,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->parseFile() throws an InvalidArgumentException if the loaded file does not validate the XSD');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->parseFile() throws an InvalidArgumentException if the loaded file does not validate the XSD');
$this->assertStringStartsWith('[ERROR 1845] Element \'nonvalid\': No matching global declaration available for the validation root. (in', $e->getMessage(), '->parseFile() throws an InvalidArgumentException if the loaded file does not validate the XSD');
}
@ -185,7 +185,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tag is not valid');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tag is not valid');
$this->assertStringStartsWith('There is no extension able to load the configuration for "foobar:foobar" (in', $e->getMessage(), '->load() throws an InvalidArgumentException if the tag is not valid');
}
@ -196,7 +196,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if an extension is not loaded');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if an extension is not loaded');
$this->assertStringStartsWith('The "foobar" tag is not valid (in', $e->getMessage(), '->load() throws an InvalidArgumentException if an extension is not loaded');
}
}

View File

@ -37,7 +37,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not exist');
$this->assertEquals('The service file "foo.yml" is not valid.', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file does not exist');
}
@ -48,7 +48,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file is not a valid YAML file');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file is not a valid YAML file');
$this->assertEquals('The service file "parameters.ini" is not valid.', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file is not a valid YAML file');
}
@ -63,7 +63,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not validate');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not validate');
$this->assertStringMatchesFormat('The service file "nonvalid%d.yml" is not valid.', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file does not validate');
}
}
@ -127,7 +127,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tag is not valid');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tag is not valid');
$this->assertStringStartsWith('There is no extension able to load the configuration for "foobar.foobar" (in', $e->getMessage(), '->load() throws an InvalidArgumentException if the tag is not valid');
}
@ -138,7 +138,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if an extension is not loaded');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if an extension is not loaded');
$this->assertStringStartsWith('The "foobar" tag is not valid (in', $e->getMessage(), '->load() throws an InvalidArgumentException if an extension is not loaded');
}
}

View File

@ -29,7 +29,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\LogicException', $e, '__construct() throws a \LogicException if the node is not an "a" tag');
$this->assertInstanceOf('\LogicException', $e, '__construct() throws a \LogicException if the node is not an "a" tag');
}
}

View File

@ -47,7 +47,7 @@ class EventTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->getParameter() throws an \InvalidArgumentException exception when the parameter does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->getParameter() throws an \InvalidArgumentException exception when the parameter does not exist');
$this->assertEquals('The event "name" has no "foobar" parameter.', $e->getMessage(), '->getParameter() throws an \InvalidArgumentException exception when the parameter does not exist');
}
$event = new Event($this->subject, 'name', $this->parameters);
@ -84,7 +84,7 @@ class EventTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '::offsetGet() throws an \InvalidArgumentException exception when the parameter does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '::offsetGet() throws an \InvalidArgumentException exception when the parameter does not exist');
$this->assertEquals('The event "name" has no "foobar" parameter.', $e->getMessage(), '::offsetGet() throws an \InvalidArgumentException exception when the parameter does not exist');
}

View File

@ -45,7 +45,7 @@ class ArrayDecoratorTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\LogicException', $e, 'The escaped object is read only (unset)');
$this->assertInstanceOf('\LogicException', $e, 'The escaped object is read only (unset)');
$this->assertEquals('Cannot unset values.', $e->getMessage(), 'The escaped object is read only (unset)');
}
@ -57,7 +57,7 @@ class ArrayDecoratorTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\LogicException', $e, 'The escaped object is read only (set)');
$this->assertInstanceOf('\LogicException', $e, 'The escaped object is read only (set)');
$this->assertEquals('Cannot set values.', $e->getMessage(), 'The escaped object is read only (set)');
}
}

View File

@ -44,7 +44,7 @@ class EscaperTest extends \PHPUnit_Framework_TestCase
'bar' => array('foo' => '<strong>escaped!</strong>'),
);
$output = Escaper::escape('entities', $input);
$this->assertType('Symfony\Components\OutputEscaper\ArrayDecorator', $output, '::escape() returns a ArrayDecorator object if the value to escape is an array');
$this->assertInstanceOf('Symfony\Components\OutputEscaper\ArrayDecorator', $output, '::escape() returns a ArrayDecorator object if the value to escape is an array');
$this->assertEquals('&lt;strong&gt;escaped!&lt;/strong&gt;', $output['foo'], '::escape() escapes all elements of the original array');
$this->assertEquals('&lt;strong&gt;escaped!&lt;/strong&gt;', $output['bar']['foo'], '::escape() is recursive');
$this->assertEquals($input, $output->getRawValue(), '->getRawValue() returns the unescaped value');
@ -54,23 +54,23 @@ class EscaperTest extends \PHPUnit_Framework_TestCase
{
$input = new OutputEscaperTestClass();
$output = Escaper::escape('entities', $input);
$this->assertType('Symfony\Components\OutputEscaper\ObjectDecorator', $output, '::escape() returns a ObjectDecorator object if the value to escape is an object');
$this->assertInstanceOf('Symfony\Components\OutputEscaper\ObjectDecorator', $output, '::escape() returns a ObjectDecorator object if the value to escape is an object');
$this->assertEquals('&lt;strong&gt;escaped!&lt;/strong&gt;', $output->getTitle(), '::escape() escapes all methods of the original object');
$this->assertEquals('&lt;strong&gt;escaped!&lt;/strong&gt;', $output->title, '::escape() escapes all properties of the original object');
$this->assertEquals('&lt;strong&gt;escaped!&lt;/strong&gt;', $output->getTitleTitle(), '::escape() is recursive');
$this->assertEquals($input, $output->getRawValue(), '->getRawValue() returns the unescaped value');
$this->assertEquals('&lt;strong&gt;escaped!&lt;/strong&gt;', Escaper::escape('entities', $output)->getTitle(), '::escape() does not double escape an object');
$this->assertType('Symfony\Components\OutputEscaper\IteratorDecorator', Escaper::escape('entities', new \DirectoryIterator('.')), '::escape() returns a IteratorDecorator object if the value to escape is an object that implements the ArrayAccess interface');
$this->assertInstanceOf('Symfony\Components\OutputEscaper\IteratorDecorator', Escaper::escape('entities', new \DirectoryIterator('.')), '::escape() returns a IteratorDecorator object if the value to escape is an object that implements the ArrayAccess interface');
}
public function testEscapeDoesNotEscapeObjectMarkedAsBeingSafe()
{
$this->assertType('Symfony\Tests\Components\OutputEscaper\OutputEscaperTestClass', Escaper::escape('entities', new SafeDecorator(new OutputEscaperTestClass())), '::escape() returns the original value if it is marked as being safe');
$this->assertInstanceOf('Symfony\Tests\Components\OutputEscaper\OutputEscaperTestClass', Escaper::escape('entities', new SafeDecorator(new OutputEscaperTestClass())), '::escape() returns the original value if it is marked as being safe');
Escaper::markClassAsSafe('Symfony\Tests\Components\OutputEscaper\OutputEscaperTestClass');
$this->assertType('Symfony\Tests\Components\OutputEscaper\OutputEscaperTestClass', Escaper::escape('entities', new OutputEscaperTestClass()), '::escape() returns the original value if the object class is marked as being safe');
$this->assertType('Symfony\Tests\Components\OutputEscaper\OutputEscaperTestClass', Escaper::escape('entities', new OutputEscaperTestClassChild()), '::escape() returns the original value if one of the object parent class is marked as being safe');
$this->assertInstanceOf('Symfony\Tests\Components\OutputEscaper\OutputEscaperTestClass', Escaper::escape('entities', new OutputEscaperTestClass()), '::escape() returns the original value if the object class is marked as being safe');
$this->assertInstanceOf('Symfony\Tests\Components\OutputEscaper\OutputEscaperTestClass', Escaper::escape('entities', new OutputEscaperTestClassChild()), '::escape() returns the original value if one of the object parent class is marked as being safe');
}
public function testEscapeCannotEscapeResources()
@ -118,21 +118,21 @@ class EscaperTest extends \PHPUnit_Framework_TestCase
$object = new OutputEscaperTestClass();
$input = Escaper::escape('entities', $object);
$output = Escaper::unescape($input);
$this->assertType('Symfony\Tests\Components\OutputEscaper\OutputEscaperTestClass', $output, '::unescape() returns the original object when a ObjectDecorator object is passed');
$this->assertInstanceOf('Symfony\Tests\Components\OutputEscaper\OutputEscaperTestClass', $output, '::unescape() returns the original object when a ObjectDecorator object is passed');
$this->assertEquals('<strong>escaped!</strong>', $output->getTitle(), '::unescape() unescapes all methods of the original object');
$this->assertEquals('<strong>escaped!</strong>', $output->title, '::unescape() unescapes all properties of the original object');
$this->assertEquals('<strong>escaped!</strong>', $output->getTitleTitle(), '::unescape() is recursive');
$this->assertType('\DirectoryIterator', IteratorDecorator::unescape(Escaper::escape('entities', new \DirectoryIterator('.'))), '::unescape() unescapes IteratorDecorator objects');
$this->assertInstanceOf('\DirectoryIterator', IteratorDecorator::unescape(Escaper::escape('entities', new \DirectoryIterator('.'))), '::unescape() unescapes IteratorDecorator objects');
}
public function testUnescapeDoesNotUnescapeObjectMarkedAsBeingSafe()
{
$this->assertType('Symfony\Tests\Components\OutputEscaper\OutputEscaperTestClass', Escaper::unescape(Escaper::escape('entities', new SafeDecorator(new OutputEscaperTestClass()))), '::unescape() returns the original value if it is marked as being safe');
$this->assertInstanceOf('Symfony\Tests\Components\OutputEscaper\OutputEscaperTestClass', Escaper::unescape(Escaper::escape('entities', new SafeDecorator(new OutputEscaperTestClass()))), '::unescape() returns the original value if it is marked as being safe');
Escaper::markClassAsSafe('OutputEscaperTestClass');
$this->assertType('Symfony\Tests\Components\OutputEscaper\OutputEscaperTestClass', Escaper::unescape(Escaper::escape('entities', new OutputEscaperTestClass())), '::unescape() returns the original value if the object class is marked as being safe');
$this->assertType('Symfony\Tests\Components\OutputEscaper\OutputEscaperTestClass', Escaper::unescape(Escaper::escape('entities', new OutputEscaperTestClassChild())), '::unescape() returns the original value if one of the object parent class is marked as being safe');
$this->assertInstanceOf('Symfony\Tests\Components\OutputEscaper\OutputEscaperTestClass', Escaper::unescape(Escaper::escape('entities', new OutputEscaperTestClass())), '::unescape() returns the original value if the object class is marked as being safe');
$this->assertInstanceOf('Symfony\Tests\Components\OutputEscaper\OutputEscaperTestClass', Escaper::unescape(Escaper::escape('entities', new OutputEscaperTestClassChild())), '::unescape() returns the original value if one of the object parent class is marked as being safe');
}
public function testUnescapeDoesNothingToResources()

View File

@ -59,7 +59,7 @@ class EngineTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->__get() throws an InvalidArgumentException if the helper is not defined');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->__get() throws an InvalidArgumentException if the helper is not defined');
$this->assertEquals('The helper "bar" is not defined.', $e->getMessage(), '->__get() throws an InvalidArgumentException if the helper is not defined');
}
}
@ -81,7 +81,7 @@ class EngineTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->get() throws an InvalidArgumentException if the helper is not defined');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->get() throws an InvalidArgumentException if the helper is not defined');
$this->assertEquals('The helper "foobar" is not defined.', $e->getMessage(), '->get() throws an InvalidArgumentException if the helper is not defined');
}
@ -99,7 +99,7 @@ class EngineTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->render() throws an InvalidArgumentException if the template does not exist');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->render() throws an InvalidArgumentException if the template does not exist');
$this->assertEquals('The template "name" does not exist (renderer: php).', $e->getMessage(), '->render() throws an InvalidArgumentException if the template does not exist');
}
@ -111,7 +111,7 @@ class EngineTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\InvalidArgumentException', $e, '->render() throws an InvalidArgumentException if no renderer is registered for the given renderer');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->render() throws an InvalidArgumentException if no renderer is registered for the given renderer');
$this->assertEquals('The template "foo" does not exist (renderer: name).', $e->getMessage(), '->render() throws an InvalidArgumentException if no renderer is registered for the given renderer');
}

View File

@ -68,7 +68,7 @@ class SlotsHelperTest extends \PHPUnit_Framework_TestCase
catch (\Exception $e)
{
$helper->stop();
$this->assertType('\InvalidArgumentException', $e, '->start() throws an InvalidArgumentException if a slot with the same name is already started');
$this->assertInstanceOf('\InvalidArgumentException', $e, '->start() throws an InvalidArgumentException if a slot with the same name is already started');
$this->assertEquals('A slot named "bar" is already started.', $e->getMessage(), '->start() throws an InvalidArgumentException if a slot with the same name is already started');
}
@ -79,7 +79,7 @@ class SlotsHelperTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\LogicException', $e, '->stop() throws an LogicException if no slot is started');
$this->assertInstanceOf('\LogicException', $e, '->stop() throws an LogicException if no slot is started');
$this->assertEquals('No slot started.', $e->getMessage(), '->stop() throws an LogicException if no slot is started');
}
}

View File

@ -46,7 +46,7 @@ class ChainLoaderTest extends \PHPUnit_Framework_TestCase
$loader = new ProjectTemplateLoader1(array(self::$loader1, self::$loader2));
$this->assertFalse($loader->load('bar'), '->load() returns false if the template is not found');
$this->assertFalse($loader->load('foo', array('renderer' => 'xml')), '->load() returns false if the template does not exists for the given renderer');
$this->assertType('Symfony\Components\Templating\Storage\FileStorage', $loader->load('foo'), '->load() returns a FileStorage if the template exists');
$this->assertInstanceOf('Symfony\Components\Templating\Storage\FileStorage', $loader->load('foo'), '->load() returns a FileStorage if the template exists');
}
}

View File

@ -49,13 +49,13 @@ class FilesystemLoaderTest extends \PHPUnit_Framework_TestCase
$path = self::$fixturesPath.'/templates';
$loader = new ProjectTemplateLoader2($pathPattern);
$storage = $loader->load($path.'/foo.php');
$this->assertType('Symfony\Components\Templating\Storage\FileStorage', $storage, '->load() returns a FileStorage if you pass an absolute path');
$this->assertInstanceOf('Symfony\Components\Templating\Storage\FileStorage', $storage, '->load() returns a FileStorage if you pass an absolute path');
$this->assertEquals($path.'/foo.php', (string) $storage, '->load() returns a FileStorage pointing to the passed absolute path');
$this->assertFalse($loader->load('bar'), '->load() returns false if the template is not found');
$storage = $loader->load('foo');
$this->assertType('Symfony\Components\Templating\Storage\FileStorage', $storage, '->load() returns a FileStorage if you pass a relative template that exists');
$this->assertInstanceOf('Symfony\Components\Templating\Storage\FileStorage', $storage, '->load() returns a FileStorage if you pass a relative template that exists');
$this->assertEquals($path.'/foo.php', (string) $storage, '->load() returns a FileStorage pointing to the absolute path of the template');
$loader = new ProjectTemplateLoader2($pathPattern);

View File

@ -19,7 +19,7 @@ class FileStorageTest extends \PHPUnit_Framework_TestCase
public function testGetContent()
{
$storage = new FileStorage('foo');
$this->assertType('Symfony\Components\Templating\Storage\Storage', $storage, 'FileStorage is an instance of Storage');
$this->assertInstanceOf('Symfony\Components\Templating\Storage\Storage', $storage, 'FileStorage is an instance of Storage');
$storage = new FileStorage(__DIR__.'/../../../../../fixtures/Symfony/Components/Templating/templates/foo.php');
$this->assertEquals('<?php echo $foo ?>', $storage->getContent(), '->getContent() returns the content of the template');
}

View File

@ -19,7 +19,7 @@ class StringStorageTest extends \PHPUnit_Framework_TestCase
public function testGetContent()
{
$storage = new StringStorage('foo');
$this->assertType('Symfony\Components\Templating\Storage\Storage', $storage, 'StringStorage is an instance of Storage');
$this->assertInstanceOf('Symfony\Components\Templating\Storage\Storage', $storage, 'StringStorage is an instance of Storage');
$storage = new StringStorage('foo');
$this->assertEquals('foo', $storage->getContent(), '->getContent() returns the content of the template');
}

View File

@ -80,7 +80,7 @@ class ParserTest extends \PHPUnit_Framework_TestCase
}
catch (\Exception $e)
{
$this->assertType('\Exception', $e, 'YAML files must not contain tabs');
$this->assertInstanceOf('\Exception', $e, 'YAML files must not contain tabs');
$this->assertEquals('A YAML file cannot contain tabs as indentation at line 2 ('.strpbrk($yaml, "\t").').', $e->getMessage(), 'YAML files must not contain tabs');
}
}