Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ExpressionLanguage] Use assertSame() instead of assertEquals() #57693

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public function testCachedParse()
public function testBasicPhpFunction($expression, $expected, $compiled)
{
$expressionLanguage = new ExpressionLanguage();
$this->assertEquals($expected, $expressionLanguage->evaluate($expression));
$this->assertEquals($compiled, $expressionLanguage->compile($expression));
$this->assertSame($expected, $expressionLanguage->evaluate($expression));
$this->assertSame($compiled, $expressionLanguage->compile($expression));
}

public static function basicPhpFunctionProvider()
Expand Down Expand Up @@ -143,14 +143,14 @@ public function testCompiledEnumFunctionWithBackedEnum()
public function testProviders(iterable $providers)
{
$expressionLanguage = new ExpressionLanguage(null, $providers);
$this->assertEquals('foo', $expressionLanguage->evaluate('identity("foo")'));
$this->assertEquals('"foo"', $expressionLanguage->compile('identity("foo")'));
$this->assertEquals('FOO', $expressionLanguage->evaluate('strtoupper("foo")'));
$this->assertEquals('\strtoupper("foo")', $expressionLanguage->compile('strtoupper("foo")'));
$this->assertEquals('foo', $expressionLanguage->evaluate('strtolower("FOO")'));
$this->assertEquals('\strtolower("FOO")', $expressionLanguage->compile('strtolower("FOO")'));
$this->assertSame('foo', $expressionLanguage->evaluate('identity("foo")'));
$this->assertSame('"foo"', $expressionLanguage->compile('identity("foo")'));
$this->assertSame('FOO', $expressionLanguage->evaluate('strtoupper("foo")'));
$this->assertSame('\strtoupper("foo")', $expressionLanguage->compile('strtoupper("foo")'));
$this->assertSame('foo', $expressionLanguage->evaluate('strtolower("FOO")'));
$this->assertSame('\strtolower("FOO")', $expressionLanguage->compile('strtolower("FOO")'));
$this->assertTrue($expressionLanguage->evaluate('fn_namespaced()'));
$this->assertEquals('\Symfony\Component\ExpressionLanguage\Tests\Fixtures\fn_namespaced()', $expressionLanguage->compile('fn_namespaced()'));
$this->assertSame('\Symfony\Component\ExpressionLanguage\Tests\Fixtures\fn_namespaced()', $expressionLanguage->compile('fn_namespaced()'));
}

public static function providerTestCases(): iterable
Expand All @@ -167,7 +167,7 @@ public static function providerTestCases(): iterable
public function testShortCircuitOperatorsEvaluate($expression, array $values, $expected)
{
$expressionLanguage = new ExpressionLanguage();
$this->assertEquals($expected, $expressionLanguage->evaluate($expression, $values));
$this->assertSame($expected, $expressionLanguage->evaluate($expression, $values));
}

/**
Expand Down
Loading