8000 Use strict assertion in asset tests · symfony/symfony@3ec1918 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3ec1918

Browse files
committed
Use strict assertion in asset tests
1 parent d6dea58 commit 3ec1918

8 files changed

+23
-23
lines changed

src/Symfony/Component/Asset/Tests/Context/RequestStackContextTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testGetBasePathSet()
3737

3838
$requestStackContext = new RequestStackContext($requestStack);
3939

40-
$this->assertEquals($testBasePath, $requestStackContext->getBasePath());
40+
$this->assertSame($testBasePath, $requestStackContext->getBasePath());
4141
}
4242

4343
public function testIsSecureFalse()

src/Symfony/Component/Asset/Tests/PackageTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class PackageTest extends TestCase
2424
public function testGetUrl($version, $format, $path, $expected)
2525
{
2626
$package = new Package($version ? new StaticVersionStrategy($version, $format) : new EmptyVersionStrategy());
27-
$this->assertEquals($expected, $package->getUrl($path));
27+
$this->assertSame($expected, $package->getUrl($path));
2828
}
2929

3030
public function getConfigs()
@@ -50,6 +50,6 @@ public function getConfigs()
5050
public function testGetVersion()
5151
{
5252
$package = new Package(new StaticVersionStrategy('v1'));
53-
$this->assertEquals('v1', $package->getVersion('/foo'));
53+
$this->assertSame('v1', $package->getVersion('/foo'));
5454
}
5555
}

src/Symfony/Component/Asset/Tests/PackagesTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ public function testGetterSetters()
2424
$packages->setDefaultPackage($default = $this->getMockBuilder('Symfony\Component\Asset\PackageInterface')->getMock());
2525
$packages->addPackage('a', $a = $this->getMockBuilder('Symfony\Component\Asset\PackageInterface')->getMock());
2626

27-
$this->assertEquals($default, $packages->getPackage());
28-
$this->assertEquals($a, $packages->getPackage('a'));
27+
$this->assertSame($default, $packages->getPackage());
28+
$this->assertSame($a, $packages->getPackage('a'));
2929

3030
$packages = new Packages($default, ['a' => $a]);
3131

32-
$this->assertEquals($default, $packages->getPackage());
33-
$this->assertEquals($a, $packages->getPackage('a'));
32+
$this->assertSame($default, $packages->getPackage());
33+
$this->assertSame($a, $packages->getPackage('a'));
3434
}
3535

3636
public function testGetVersion()
@@ -40,8 +40,8 @@ public function testGetVersion()
4040
['a' => new Package(new StaticVersionStrategy('a'))]
4141
);
4242

43-
$this->assertEquals('default', $packages->getVersion('/foo'));
44-
$this->assertEquals('a', $packages->getVersion('/foo', 'a'));
43+
$this->assertSame('default', $packages->getVersion('/foo'));
44+
$this->assertSame('a', $packages->getVersion('/foo', 'a'));
4545
}
4646

4747
public function testGetUrl()
@@ -51,8 +51,8 @@ public function testGetUrl()
5151
['a' => new Package(new StaticVersionStrategy('a'))]
5252
);
5353

54-
$this->assertEquals('/foo?default', $packages->getUrl('/foo'));
55-
$this->assertEquals('/foo?a', $packages->getUrl('/foo', 'a'));
54+
$this->assertSame('/foo?default', $packages->getUrl('/foo'));
55+
$this->assertSame('/foo?a', $packages->getUrl('/foo', 'a'));
5656
}
5757

5858
public function testNoDefaultPackage()

src/Symfony/Component/Asset/Tests/PathPackageTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class PathPackageTest extends TestCase
2323
public function testGetUrl($basePath, $format, $path, $expected)
2424
{
2525
$package = new PathPackage($basePath, new StaticVersionStrategy('v1', $format));
26-
$this->assertEquals($expected, $package->getUrl($path));
26+
$this->assertSame($expected, $package->getUrl($path));
2727
}
2828

2929
public function getConfigs()
@@ -55,7 +55,7 @@ public function testGetUrlWithContext($basePathRequest, $basePath, $format, $pat
5555
{
5656
$package = new PathPackage($basePath, new StaticVersionStrategy('v1', $format), $this->getContext($basePathRequest));
5757

58-
$this->assertEquals($expected, $package->getUrl($path));
58+
$this->assertSame($expected, $package->getUrl($path));
5959
}
6060

6161
public function getContextConfigs()
@@ -83,7 +83,7 @@ public function testVersionStrategyGivesAbsoluteURL()
8383
->willReturn('https://cdn.com/bar/main.css');
8484
$package = new PathPackage('/subdirectory', $versionStrategy, $this->getContext('/bar'));
8585

86-
$this->assertEquals('https://cdn.com/bar/main.css', $package->getUrl('main.css'));
86+
$this->assertSame('https://cdn.com/bar/main.css', $package->getUrl('main.css'));
8787
}
8888

8989
private function getContext($basePath)

src/Symfony/Component/Asset/Tests/UrlPackageTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class UrlPackageTest extends TestCase
2424
public function testGetUrl($baseUrls, $format, $path, $expected)
2525
{
2626
$package = new UrlPackage($baseUrls, new StaticVersionStrategy('v1', $format));
27-
$this->assertEquals($expected, $package->getUrl($path));
27+
$this->assertSame($expected, $package->getUrl($path));
2828
}
2929

3030
public function getConfigs()
@@ -58,7 +58,7 @@ public function testGetUrlWithContext($secure, $baseUrls, $format, $path, $expec
5858
{
5959
$package = new UrlPackage($baseUrls, new StaticVersionStrategy('v1', $format), $this->getContext($secure));
6060

61-
$this->assertEquals($expected, $package->getUrl($path));
61+
$this->assertSame($expected, $package->getUrl($path));
6262
}
6363

6464
public function getContextConfigs()
@@ -85,7 +85,7 @@ public function testVersionStrategyGivesAbsoluteURL()
8585
->willReturn('https://cdn.com/bar/main.css');
8686
$package = new UrlPackage('https://example.com', $versionStrategy);
8787

88-
$this->assertEquals('https://cdn.com/bar/main.css', $package->getUrl('main.css'));
88+
$this->assertSame('https://cdn.com/bar/main.css', $package->getUrl('main.css'));
8989
}
9090

9191
public function testNoBaseUrls()

src/Symfony/Component/Asset/Tests/VersionStrategy/EmptyVersionStrategyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ public function testApplyVersion()
2929
$emptyVersionStrategy = new EmptyVersionStrategy();
3030
$path = 'test-path';
3131

32-
$this->assertEquals($path, $emptyVersionStrategy->applyVersion($path));
32+
$this->assertSame($path, $emptyVersionStrategy->applyVersion($path));
3333
}
3434
}

src/Symfony/Component/Asset/Tests/VersionStrategy/JsonManifestVersionStrategyTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ public function testGetVersion()
2020
{
2121
$strategy = $this->createStrategy('manifest-valid.json');
2222

23-
$this->assertEquals('main.123abc.js', $strategy->getVersion('main.js'));
23+
$this->assertSame('main.123abc.js', $strategy->getVersion('main.js'));
2424
}
2525

2626
public function testApplyVersion()
2727
{
2828
$strategy = $this->createStrategy('manifest-valid.json');
2929

30-
$this->assertEquals('css/styles.555def.css', $strategy->getVersion('css/styles.css'));
30+
$this->assertSame('css/styles.555def.css', $strategy->getVersion('css/styles.css'));
3131
}
3232

3333
public function testApplyVersionWhenKeyDoesNotExistInManifest()
3434
{
3535
$strategy = $this->createStrategy('manifest-valid.json');
3636

37-
$this->assertEquals('css/other.css', $strategy->getVersion('css/other.css'));
37+
$this->assertSame('css/other.css', $strategy->getVersion('css/other.css'));
3838
}
3939

4040
public function testMissingManifestFileThrowsException()

src/Symfony/Component/Asset/Tests/VersionStrategy/StaticVersionStrategyTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function testGetVersion()
2121
$version = 'v1';
2222
$path = 'test-path';
2323
$staticVersionStrategy = new StaticVersionStrategy($version);
24-
$this->assertEquals($version, $staticVersionStrategy->getVersion($path));
24+
$this->assertSame($version, $staticVersionStrategy->getVersion($path));
2525
}
2626

2727
/**
@@ -31,7 +31,7 @@ public function testApplyVersion($path, $version, $format)
3131
{
3232
$staticVersionStrategy = new StaticVersionStrategy($version, $format);
3333
$formatted = sprintf($format ?: '%s?%s', $path, $version);
34-
$this->assertEquals($formatted, $staticVersionStrategy->applyVersion($path));
34+
$this->assertSame($formatted, $staticVersionStrategy->applyVersion($path));
3535
}
3636

3737
public function getConfigs()

0 commit comments

Comments
 (0)
0