Skip to content

Commit

Permalink
Use assertSame instead of assertEquals
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfelles committed Jul 27, 2022
1 parent e8b6a09 commit 2c32e26
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
16 changes: 8 additions & 8 deletions tests/AutoloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ public function testNamespaces() : void
'Tests' => __DIR__,
]);
$dir = __DIR__ . \DIRECTORY_SEPARATOR;
self::assertEquals([$dir], $this->autoloader->getNamespace('Tests'));
self::assertSame([$dir], $this->autoloader->getNamespace('Tests'));
self::assertEmpty($this->autoloader->getNamespace('Testss'));
self::assertEquals([
self::assertSame([
'Tests' => [$dir],
'Foo\Bar' => [$dir, $dir],
], $this->autoloader->getNamespaces());
$this->autoloader->removeNamespaces(['Tests']);
self::assertEquals([
self::assertSame([
'Foo\Bar' => [$dir, $dir],
], $this->autoloader->getNamespaces());
$this->autoloader->addNamespaces([
'\Foo\Bar' => [__DIR__],
]);
self::assertEquals([
self::assertSame([
'Foo\Bar' => [$dir, $dir, $dir],
], $this->autoloader->getNamespaces());
}
Expand All @@ -53,15 +53,15 @@ public function testClasses() : void
'\\' . __CLASS__ => __FILE__,
'\Tests\LocatorTest' => __DIR__ . '/LocatorTest.php',
]);
self::assertEquals(
self::assertSame(
[
__CLASS__ => __FILE__,
'Tests\LocatorTest' => __DIR__ . '/LocatorTest.php',
],
$this->autoloader->getClasses()
);
$this->autoloader->removeClasses([__CLASS__]);
self::assertEquals(
self::assertSame(
[
'Tests\LocatorTest' => __DIR__ . '/LocatorTest.php',
],
Expand All @@ -73,9 +73,9 @@ public function testFindClassPath() : void
{
self::assertNull($this->autoloader->findClassPath(__CLASS__));
$this->autoloader->setNamespace(__NAMESPACE__, __DIR__);
self::assertEquals(__FILE__, $this->autoloader->findClassPath(__CLASS__));
self::assertSame(__FILE__, $this->autoloader->findClassPath(__CLASS__));
$this->autoloader->setClass(__CLASS__, __FILE__);
self::assertEquals(__FILE__, $this->autoloader->findClassPath(__CLASS__));
self::assertSame(__FILE__, $this->autoloader->findClassPath(__CLASS__));
}

public function testLoadClass() : void
Expand Down
26 changes: 13 additions & 13 deletions tests/LocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,33 +49,33 @@ public function testListFiles() : void
{
self::assertNull($this->locator->listFiles(__DIR__ . '/unknown'));
$list = $this->getFiles();
self::assertEquals($list, $this->locator->listFiles(__DIR__));
self::assertEquals($list, $this->locator->listFiles(__DIR__ . '/../tests'));
self::assertSame($list, $this->locator->listFiles(__DIR__));
self::assertSame($list, $this->locator->listFiles(__DIR__ . '/../tests'));
}

public function testGetClass() : void
{
self::assertEquals(__CLASS__, $this->locator->getClassName(__FILE__));
self::assertSame(__CLASS__, $this->locator->getClassName(__FILE__));
self::assertNull($this->locator->getClassName(__DIR__ . '/unknown'));
self::assertEquals(
self::assertSame(
'Foo\NamespacedClass',
$this->locator->getClassName(__DIR__ . '/support/NamespacedClass.php')
);
self::assertNull($this->locator->getClassName(__DIR__ . '/support/NoClass.php'));
self::assertNull($this->locator->getClassName(__DIR__ . '/support/ReturnObject.php'));
self::assertEquals(
self::assertSame(
'OneClass',
$this->locator->getClassName(__DIR__ . '/support/OneClass.php')
);
self::assertEquals(
self::assertSame(
'OneInterface',
$this->locator->getClassName(__DIR__ . '/support/OneInterface.php')
);
self::assertEquals(
self::assertSame(
'Foo\Bar\Baz\OneTrait',
$this->locator->getClassName(__DIR__ . '/support/OneTrait.php')
);
self::assertEquals(
self::assertSame(
'Foo\Bar\Baz\OneEnum',
$this->locator->getClassName(__DIR__ . '/support/OneEnum.php')
);
Expand All @@ -84,7 +84,7 @@ public function testGetClass() : void
public function testGetFiles() : void
{
$this->autoloader->setNamespace('Autoload', __DIR__ . '/..');
self::assertEquals(
self::assertSame(
$this->getFiles(),
$this->locator->getFiles('tests')
);
Expand All @@ -93,13 +93,13 @@ public function testGetFiles() : void
public function testFindFiles() : void
{
$this->autoloader->setNamespace('Tests', __DIR__);
self::assertEquals(
self::assertSame(
[
__DIR__ . '/LocatorTest.php',
],
$this->locator->findFiles('LocatorTest')
);
self::assertEquals(
self::assertSame(
[
__DIR__ . '/LocatorTest.php',
],
Expand All @@ -113,12 +113,12 @@ public function testFindFiles() : void
public function testNamespacedFilepath() : void
{
$this->autoloader->setNamespace('Tests\Foo', __DIR__);
self::assertEquals(
self::assertSame(
__FILE__,
$this->locator->getNamespacedFilepath('Tests/Foo/LocatorTest')
);
$this->autoloader->setNamespace('Tests', __DIR__);
self::assertEquals(
self::assertSame(
__FILE__,
$this->locator->getNamespacedFilepath('Tests/LocatorTest')
);
Expand Down

0 comments on commit 2c32e26

Please sign in to comment.