Permalink
Browse files

tests: equal() replaced with same()

  • Loading branch information...
1 parent 7bf01dd commit 5b6756f929bd0faff01eb71f00552fc723c5fce2 @dg dg committed Aug 29, 2012
@@ -270,11 +270,11 @@ public function macroBlock(MacroNode $node, PhpWriter $writer)
if ($node->name === 'snippet') {
$node->data->name = $name = '_' . $name;
}
-
+
if (isset($this->namedBlocks[$name])) {
throw new CompileException("Cannot redeclare static block '$name'");
}
-
+
$prolog = $this->namedBlocks ? '' : "if (\$_l->extends) { ob_end_clean(); return Nette\\Latte\\Macros\\CoreMacros::includeTemplate(\$_l->extends, get_defined_vars(), \$template)->render(); }\n";
$top = empty($node->parentNode);
$this->namedBlocks[$name] = TRUE;
@@ -37,7 +37,7 @@ $presenter->run(new Request('Nette:Micro', 'GET', array(
'id' => 1,
'page' => 2,
)));
-Assert::equal(array(
+Assert::same(array(
'Callback id 1 page 2'
), TestHelpers::fetchNotes());
@@ -47,6 +47,6 @@ $presenter->run(new Request('Nette:Micro', 'GET', array(
'id' => 1,
'page' => 2,
)));
-Assert::equal(array(
+Assert::same(array(
'Callback id 1 page 2'
), TestHelpers::fetchNotes());
@@ -180,6 +180,6 @@ $request = new Application\Request('Test', Http\Request::GET, array());
$presenter = new TestPresenter;
$presenter->invalidLinkMode = TestPresenter::INVALID_LINK_WARNING;
$container->callMethod(array($presenter, 'injectPrimary'), array(7 => $container->parameters['debugMode']));
-Assert::equal(TestPresenter::INVALID_LINK_WARNING, $presenter->invalidLinkMode);
+Assert::same(TestPresenter::INVALID_LINK_WARNING, $presenter->invalidLinkMode);
$presenter->autoCanonicalize = FALSE;
$presenter->run($request);
@@ -119,8 +119,8 @@ $presenter->run($applicationRequest);
$expiration = '+1 year';
$key = $presenter->storeRequest($expiration);
-Assert::equal($expiration, $section->testExpiration);
-Assert::equal($key, $section->testExpirationVariables);
-Assert::equal($key, $section->testedKeyExistence);
-Assert::equal($key, $section->storedKey);
+Assert::same($expiration, $section->testExpiration);
+Assert::same($key, $section->testExpirationVariables);
+Assert::same($key, $section->testedKeyExistence);
+Assert::same($key, $section->storedKey);
Assert::same(array($user->getId(), $applicationRequest), $section->storedValue);
@@ -25,12 +25,12 @@ $block = $cache->start('key');
Assert::true( $block instanceof Nette\Caching\OutputHelper );
echo 'Hello';
$block->end();
-Assert::equal( 'Hello', ob_get_clean() );
+Assert::same( 'Hello', ob_get_clean() );
-Assert::equal( 'Hello', $cache->load('key') );
+Assert::same( 'Hello', $cache->load('key') );
ob_start();
Assert::null( $cache->start('key') );
-Assert::equal( 'Hello', ob_get_clean() );
+Assert::same( 'Hello', ob_get_clean() );
@@ -36,7 +36,7 @@ Assert::same( 'hello', $container->parameters['bar'] );
Assert::same( 'hello world', constant('BAR') );
Assert::same( 'Europe/Prague', date_default_timezone_get() );
-Assert::equal( array(
+Assert::same( array(
'dsn' => 'sqlite2::memory:',
'user' => 'dbuser',
'password' => 'secret',
@@ -23,7 +23,7 @@ class DatabaseExtension extends Nette\Config\CompilerExtension
public function loadConfiguration()
{
- Assert::equal( array('foo' => 'hello'), $this->config );
+ Assert::same( array('foo' => 'hello'), $this->config );
TestHelpers::note(__METHOD__);
}
@@ -71,6 +71,6 @@ Assert::same( array('a', 'b'), $container->getService('one')->args );
Assert::same( array(array('methodA', array('a', 'b'))), $container->getService('one')->methods );
Assert::true( $container->getService('two') instanceof Service );
-Assert::equal( array(array(1 => 'a', $container->getService('one'))), $container->getService('two')->args );
+Assert::same( array(array(1 => 'a', $container->getService('one'))), $container->getService('two')->args );
Assert::true( $container->getService('three') instanceof Service );
@@ -67,7 +67,7 @@ $form->addGroup();
$form->addSubmit('submit', 'Send');
$form->fireEvents();
-Assert::equal( array(
+Assert::same( array(
'first' => array(
'name' => 'James Bond',
'email' => 'bond@007.com',
@@ -24,15 +24,15 @@ $upload = new FileUpload(array(
'size' => 209,
));
-Assert::equal( 'readme.txt', $upload->getName() );
-Assert::equal( 'readme.txt', $upload->getSanitizedName() );
-Assert::equal( 209, $upload->getSize() );
-Assert::equal( __DIR__ . '/files/file.txt', $upload->getTemporaryFile() );
-Assert::equal( __DIR__ . '/files/file.txt', (string) $upload );
-Assert::equal( 0, $upload->getError() );
+Assert::same( 'readme.txt', $upload->getName() );
+Assert::same( 'readme.txt', $upload->getSanitizedName() );
+Assert::same( 209, $upload->getSize() );
+Assert::same( __DIR__ . '/files/file.txt', $upload->getTemporaryFile() );
+Assert::same( __DIR__ . '/files/file.txt', (string) $upload );
+Assert::same( 0, $upload->getError() );
Assert::true( $upload->isOk() );
Assert::false( $upload->isImage() );
-Assert::equal( file_get_contents(__DIR__ . '/files/file.txt'), $upload->getContents() );
+Assert::same( file_get_contents(__DIR__ . '/files/file.txt'), $upload->getContents() );
@@ -44,7 +44,7 @@ $upload = new FileUpload(array(
'size' => 209,
));
-Assert::equal( '../.image.png', $upload->getName() );
-Assert::equal( 'image.png', $upload->getSanitizedName() );
-Assert::equal( 'image/png', $upload->getContentType() );
+Assert::same( '../.image.png', $upload->getName() );
+Assert::same( 'image.png', $upload->getSanitizedName() );
+Assert::same( 'image/png', $upload->getContentType() );
Assert::true( $upload->isImage() );
@@ -19,35 +19,35 @@ require __DIR__ . '/../bootstrap.php';
$parser = new Latte\Parser();
-Assert::equal( array('?', 'echo', ''), $parser->parseMacroTag('? echo') );
-Assert::equal( array('?', 'echo', ''), $parser->parseMacroTag('?echo') );
-Assert::equal( array('?', '', ''), $parser->parseMacroTag('?') );
-Assert::equal( array('=', '$var', '|escape'), $parser->parseMacroTag('$var') );
-Assert::equal( array('=', '$var', ''), $parser->parseMacroTag('!$var') );
-Assert::equal( array('=', '$var', ''), $parser->parseMacroTag('! $var') );
-Assert::equal( array('_', '"I love Nette"', ''), $parser->parseMacroTag('!_"I love Nette"') );
-Assert::equal( array('_', '$var', '|escape'), $parser->parseMacroTag('_$var') );
-Assert::equal( array('_', '$var', '|escape'), $parser->parseMacroTag('_ $var') );
-Assert::equal( array('_', '', '|escape'), $parser->parseMacroTag('_') );
-Assert::equal( array('/_', '', ''), $parser->parseMacroTag('/_') );
-Assert::equal( array('=', '$var', ''), $parser->parseMacroTag('!=$var') );
-Assert::equal( array('=', '$var', '|escape'), $parser->parseMacroTag('=$var') );
-Assert::equal( array('=', '$var', '|escape'), $parser->parseMacroTag('= $var') );
-Assert::equal( array('=', 'function()', '|escape'), $parser->parseMacroTag('function()') );
-Assert::equal( array('=', 'md5()', '|escape'), $parser->parseMacroTag('md5()') );
-Assert::equal( array('foo:bar', '', ''), $parser->parseMacroTag('foo:bar') );
-Assert::equal( array('=', ':bar', '|escape'), $parser->parseMacroTag(':bar') );
-Assert::equal( array('=', 'class::member', '|escape'), $parser->parseMacroTag('class::member') );
-Assert::equal( array('Link', '$var', ''), $parser->parseMacroTag('Link $var') );
-Assert::equal( array('link', '$var', ''), $parser->parseMacroTag('link $var') );
-Assert::equal( array('link', '$var', ''), $parser->parseMacroTag('link$var') );
-Assert::equal( array('block', '#name', ''), $parser->parseMacroTag('block #name') );
-Assert::equal( array('block', '#name', ''), $parser->parseMacroTag('block#name') );
-Assert::equal( array('/block', '', ''), $parser->parseMacroTag('/block') );
-Assert::equal( array('/block', '#name', ''), $parser->parseMacroTag('/block#name') );
-Assert::equal( array('/', '', ''), $parser->parseMacroTag('/') );
-Assert::equal( array('l', '', ''), $parser->parseMacroTag('l') );
-Assert::equal( array('=', '10', '|escape'), $parser->parseMacroTag('10') );
-Assert::equal( array('=', "'str'", '|escape'), $parser->parseMacroTag("'str'") );
-Assert::equal( array('=', '+10', '|escape'), $parser->parseMacroTag('+10') );
-Assert::equal( array('=', '-10', '|escape'), $parser->parseMacroTag('-10') );
+Assert::same( array('?', 'echo', ''), $parser->parseMacroTag('? echo') );
+Assert::same( array('?', 'echo', ''), $parser->parseMacroTag('?echo') );
+Assert::same( array('?', '', ''), $parser->parseMacroTag('?') );
+Assert::same( array('=', '$var', '|escape'), $parser->parseMacroTag('$var') );
+Assert::same( array('=', '$var', ''), $parser->parseMacroTag('!$var') );
+Assert::same( array('=', '$var', ''), $parser->parseMacroTag('! $var') );
+Assert::same( array('_', '"I love Nette"', ''), $parser->parseMacroTag('!_"I love Nette"') );
+Assert::same( array('_', '$var', '|escape'), $parser->parseMacroTag('_$var') );
+Assert::same( array('_', '$var', '|escape'), $parser->parseMacroTag('_ $var') );
+Assert::same( array('_', '', '|escape'), $parser->parseMacroTag('_') );
+Assert::same( array('/_', '', ''), $parser->parseMacroTag('/_') );
+Assert::same( array('=', '$var', ''), $parser->parseMacroTag('!=$var') );
+Assert::same( array('=', '$var', '|escape'), $parser->parseMacroTag('=$var') );
+Assert::same( array('=', '$var', '|escape'), $parser->parseMacroTag('= $var') );
+Assert::same( array('=', 'function()', '|escape'), $parser->parseMacroTag('function()') );
+Assert::same( array('=', 'md5()', '|escape'), $parser->parseMacroTag('md5()') );
+Assert::same( array('foo:bar', '', ''), $parser->parseMacroTag('foo:bar') );
+Assert::same( array('=', ':bar', '|escape'), $parser->parseMacroTag(':bar') );
+Assert::same( array('=', 'class::member', '|escape'), $parser->parseMacroTag('class::member') );
+Assert::same( array('Link', '$var', ''), $parser->parseMacroTag('Link $var') );
+Assert::same( array('link', '$var', ''), $parser->parseMacroTag('link $var') );
+Assert::same( array('link', '$var', ''), $parser->parseMacroTag('link$var') );
+Assert::same( array('block', '#name', ''), $parser->parseMacroTag('block #name') );
+Assert::same( array('block', '#name', ''), $parser->parseMacroTag('block#name') );
+Assert::same( array('/block', '', ''), $parser->parseMacroTag('/block') );
+Assert::same( array('/block', '#name', ''), $parser->parseMacroTag('/block#name') );
+Assert::same( array('/', '', ''), $parser->parseMacroTag('/') );
+Assert::same( array('l', '', ''), $parser->parseMacroTag('l') );
+Assert::same( array('=', '10', '|escape'), $parser->parseMacroTag('10') );
+Assert::same( array('=', "'str'", '|escape'), $parser->parseMacroTag("'str'") );
+Assert::same( array('=', '+10', '|escape'), $parser->parseMacroTag('+10') );
+Assert::same( array('=', '-10', '|escape'), $parser->parseMacroTag('-10') );
@@ -50,22 +50,22 @@ Assert::same(
Neon::encode(array('foo' => 1, 'bar' => array(2, 3)))
);
-Assert::equal(
+Assert::same(
'item(a, b)',
Neon::encode(Neon::decode('item(a, b)'))
);
-Assert::equal(
+Assert::same(
'item<item>(a, b)',
Neon::encode(Neon::decode('item<item>(a, b)'))
);
-Assert::equal(
+Assert::same(
'item(foo: a, bar: b)',
Neon::encode(Neon::decode('item(foo: a, bar: b)'))
);
-Assert::equal(
+Assert::same(
'[]()',
Neon::encode(Neon::decode('[]()'))
);

0 comments on commit 5b6756f

Please sign in to comment.