Skip to content

Commit

Permalink
assertEquals -> assertEqualsRN
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHenryIE committed Feb 22, 2024
1 parent 51a4cdf commit 3cb3317
Show file tree
Hide file tree
Showing 18 changed files with 105 additions and 105 deletions.
2 changes: 1 addition & 1 deletion tests/Issues/MozartIssue129Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function test_test($phpString, $expected)

$result = $replacer->replaceNamespace($phpString, $original, $replacement);

self::assertEquals($expected, $result);
self::assertEqualsRN($expected, $result);
}

public static function pairTestDataProvider()
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/MozartIssue48Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testRubixTensorBothPathsPersist()

$result = $mozartCompose->run($inputInterfaceMock, $outputInterfaceMock);

self::assertEquals(0, $result);
self::assertEqualsRN(0, $result);

// EigenvalueDecomposition.php
// assert file exists somewhere in the tree
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/MozartIssue89Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function it_moves_each_file_once_per_namespace()
}

// On the failing test, an exception was thrown and this line was not reached.
self::assertEquals(0, $result, 'Failed running under PHP ' . phpversion());
self::assertEqualsRN(0, $result, 'Failed running under PHP ' . phpversion());

self::assertNull($exception);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/MozartIssue90Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function testLibpdfmergeSucceeds()

$result = $mozartCompose->run($inputInterfaceMock, $outputInterfaceMock);

self::assertEquals(0, $result);
self::assertEqualsRN(0, $result);

// This test would only fail on Windows?
self::assertDirectoryDoesNotExist($this->testsWorkingDir .'strauss/iio/libmergepdf/vendor/iio/libmergepdf/tcpdi');
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/MozartIssue97Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ public function testCrewlabsUnsplashSucceeds()

$result = $mozartCompose->run($inputInterfaceMock, $outputInterfaceMock);

self::assertEquals(0, $result);
self::assertEqualsRN(0, $result);
}
}
4 changes: 2 additions & 2 deletions tests/Issues/StraussIssue11Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public function test_migrate_mozart_config()
$input = $this->createMock(InputInterface::class);
$straussConfig = new StraussConfig($composer, $input);

self::assertEquals('src/Mozart/', $straussConfig->getTargetDirectory());
self::assertEqualsRN('src/Mozart/', $straussConfig->getTargetDirectory());

self::assertEquals("MZoo\\MBO_Sandbox\\Dependencies", $straussConfig->getNamespacePrefix());
self::assertEqualsRN("MZoo\\MBO_Sandbox\\Dependencies", $straussConfig->getNamespacePrefix());
}


Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/StraussIssue22Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function test_virtual_package()

$result = $mozartCompose->run($inputInterfaceMock, $outputInterfaceMock);

self::assertEquals(0, $result);
self::assertEqualsRN(0, $result);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/StraussIssue76Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ public function test_psr4_array()

$result = $strauss->run($inputInterfaceMock, $outputInterfaceMock);

self::assertEquals(0, $result);
self::assertEqualsRN(0, $result);
}
}
2 changes: 1 addition & 1 deletion tests/Issues/StraussIssue79Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function test_namespace_keyword_on_opening_line()

$result = $strauss->run($inputInterfaceMock, $outputInterfaceMock);

self::assertEquals(0, $result);
self::assertEqualsRN(0, $result);

$php_string = file_get_contents($this->testsWorkingDir . '/vendor-prefixed/json-mapper/json-mapper/src/JsonMapper.php');
self::assertStringNotContainsString('throw new \BH_Strauss_Issue79_JsonException(json_last_error_msg()', $php_string);
Expand Down
4 changes: 2 additions & 2 deletions tests/Issues/StraussIssue80Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function test_namespace_keyword_on_opening_line()

$result = $strauss->run($inputInterfaceMock, $outputInterfaceMock);

self::assertEquals(0, $result);
self::assertEqualsRN(0, $result);

$php_string = file_get_contents($this->testsWorkingDir . 'vendor-prefixed/league/oauth2-linkedin/src/Provider/LinkedInResourceOwner.php');
self::assertStringNotContainsString('class Issue_80_LinkedInResourceOwner extends GenericResourceOwner', $php_string);
Expand Down Expand Up @@ -122,7 +122,7 @@ public function test_google_api_single_backslash_in_string(): void

$result = $strauss->run($inputInterfaceMock, $outputInterfaceMock);

self::assertEquals(0, $result);
self::assertEqualsRN(0, $result);

$php_string = file_get_contents($this->testsWorkingDir . 'vendor-prefixed/google/apiclient/src/aliases.php');
self::assertStringNotContainsString("'Company\\Project\\\Google\\\\Client' => 'Prefix_Google_Client',", $php_string);
Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/StraussIssue83Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function test_namespace_keyword_on_opening_line()

$result = $strauss->run($inputInterfaceMock, $outputInterfaceMock);

self::assertEquals(0, $result);
self::assertEqualsRN(0, $result);

$php_string = file_get_contents($this->testsWorkingDir . '/vendor-prefixed/aws/aws-sdk-php/src/ClientResolver.php');

Expand Down
2 changes: 1 addition & 1 deletion tests/Issues/StraussIssue8Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function test_delete_vendor_files()

$result = $mozartCompose->run($inputInterfaceMock, $outputInterfaceMock);

self::assertEquals(0, $result);
self::assertEqualsRN(0, $result);

self::assertFileDoesNotExist($this->testsWorkingDir. 'vendor/htmlburger/carbon-fields/core/Carbon_Fields.php');
}
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

class TestCase extends \PHPUnit\Framework\TestCase
{
public static function assertEquals($expected, $actual, string $message = ''): void
public static function assertEqualsRN($expected, $actual, string $message = ''): void
{
if (is_string($expected) && is_string($actual)) {
$expected = str_replace("\r\n", "\n", $expected);
$actual = str_replace("\r\n", "\n", $actual);
}

parent::assertEquals($expected, $actual, $message);
self::assertEquals($expected, $actual, $message);
}
}
2 changes: 1 addition & 1 deletion tests/Unit/Composer/ComposerPackageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testParseJson()

$composer = ComposerPackage::fromFile($testFile);

self::assertEquals('iio/libmergepdf', $composer->getPackageName());
self::assertEqualsRN('iio/libmergepdf', $composer->getPackageName());

self::assertIsArray($composer->getAutoload());

Expand Down
28 changes: 14 additions & 14 deletions tests/Unit/Composer/Extra/StraussConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ public function testGetters()

self::assertContains('pimple/pimple', $sut->getPackages());

self::assertEquals('target_directory' . DIRECTORY_SEPARATOR, $sut->getTargetDirectory());
self::assertEqualsRN( 'target_directory' . DIRECTORY_SEPARATOR, $sut->getTargetDirectory());

self::assertEquals("BrianHenryIE\\Strauss", $sut->getNamespacePrefix());
self::assertEqualsRN("BrianHenryIE\\Strauss", $sut->getNamespacePrefix());

self::assertEquals('BrianHenryIE_Strauss_', $sut->getClassmapPrefix());
self::assertEqualsRN('BrianHenryIE_Strauss_', $sut->getClassmapPrefix());

self::assertArrayHasKey('clancats/container', $sut->getOverrideAutoload());

Expand Down Expand Up @@ -171,7 +171,7 @@ public function testDefaultTargetDir()

$sut = new StraussConfig($composer, $this->createMock(InputInterface::class));

self::assertEquals('vendor-prefixed'. DIRECTORY_SEPARATOR, $sut->getTargetDirectory());
self::assertEqualsRN( 'vendor-prefixed' . DIRECTORY_SEPARATOR, $sut->getTargetDirectory());
}

/**
Expand Down Expand Up @@ -202,7 +202,7 @@ public function testDefaultNamespacePrefixFromAutoloaderPsr4()

$sut = new StraussConfig($composer, $this->createMock(InputInterface::class));

self::assertEquals("BrianHenryIE\\Strauss", $sut->getNamespacePrefix());
self::assertEqualsRN("BrianHenryIE\\Strauss", $sut->getNamespacePrefix());
}

/**
Expand Down Expand Up @@ -232,7 +232,7 @@ public function testDefaultNamespacePrefixFromAutoloaderPsr0()

$sut = new StraussConfig($composer, $this->createMock(InputInterface::class));

self::assertEquals("BrianHenryIE\\Strauss", $sut->getNamespacePrefix());
self::assertEqualsRN("BrianHenryIE\\Strauss", $sut->getNamespacePrefix());
}

/**
Expand All @@ -259,7 +259,7 @@ public function testDefaultNamespacePrefixWithNoAutoloader()

$sut = new StraussConfig($composer, $this->createMock(InputInterface::class));

self::assertEquals("Brianhenryie\\Strauss_Config_Test", $sut->getNamespacePrefix());
self::assertEqualsRN("Brianhenryie\\Strauss_Config_Test", $sut->getNamespacePrefix());
}

/**
Expand Down Expand Up @@ -290,7 +290,7 @@ public function testDefaultClassmapPrefixFromAutoloaderPsr4()

$sut = new StraussConfig($composer, $this->createMock(InputInterface::class));

self::assertEquals("BrianHenryIE_Strauss_", $sut->getClassmapPrefix());
self::assertEqualsRN("BrianHenryIE_Strauss_", $sut->getClassmapPrefix());
}

/**
Expand Down Expand Up @@ -321,7 +321,7 @@ public function testDefaultClassmapPrefixFromAutoloaderPsr0()

$sut = new StraussConfig($composer, $this->createMock(InputInterface::class));

self::assertEquals("BrianHenryIE_Strauss_", $sut->getClassmapPrefix());
self::assertEqualsRN("BrianHenryIE_Strauss_", $sut->getClassmapPrefix());
}

/**
Expand All @@ -348,7 +348,7 @@ public function testDefaultClassmapPrefixWithNoAutoloader()

$sut = new StraussConfig($composer, $this->createMock(InputInterface::class));

self::assertEquals("Brianhenryie_Strauss_Config_Test", $sut->getClassmapPrefix());
self::assertEqualsRN("Brianhenryie_Strauss_Config_Test", $sut->getClassmapPrefix());
}

/**
Expand Down Expand Up @@ -589,11 +589,11 @@ public function testMapMozartConfig()

self::assertContains('pimple/pimple', $sut->getPackages());

self::assertEquals('dep_directory' . DIRECTORY_SEPARATOR, $sut->getTargetDirectory());
self::assertEqualsRN( 'dep_directory' . DIRECTORY_SEPARATOR, $sut->getTargetDirectory());

self::assertEquals("My_Mozart_Config", $sut->getNamespacePrefix());
self::assertEqualsRN("My_Mozart_Config", $sut->getNamespacePrefix());

self::assertEquals('My_Mozart_Config_', $sut->getClassmapPrefix());
self::assertEqualsRN('My_Mozart_Config_', $sut->getClassmapPrefix());

self::assertContains('psr/container', $sut->getExcludePackagesFromPrefixing());

Expand Down Expand Up @@ -630,7 +630,7 @@ public function testNamespacePrefixHasNoSlash()

$sut = new StraussConfig($composer, $this->createMock(InputInterface::class));

self::assertEquals("My_Mozart_Config", $sut->getNamespacePrefix());
self::assertEqualsRN("My_Mozart_Config", $sut->getNamespacePrefix());
}

public function testIncludeModifiedDateDefaultTrue()
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Composer/ProjectComposerPackageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ public function testGetFlatAutoloadKey()

$expected = ["src","includes","classes","functions.php"];

self::assertEquals($expected, $phpFiles);
self::assertEqualsRN($expected, $phpFiles);
}
}
18 changes: 9 additions & 9 deletions tests/Unit/LicenserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function testAppendHeaderCommentInformationNoHeader()
'proprietary'
);

self::assertEquals($expected, $actual);
self::assertEqualsRN($expected, $actual);
}


Expand Down Expand Up @@ -159,7 +159,7 @@ public function testAppendHeaderCommentNoDate()
'proprietary'
);

self::assertEquals($expected, $actual);
self::assertEqualsRN($expected, $actual);
}

/**
Expand Down Expand Up @@ -199,7 +199,7 @@ public function testAppendHeaderCommentNoAuthor()
'proprietary'
);

self::assertEquals($expected, $actual);
self::assertEqualsRN($expected, $actual);
}

/**
Expand Down Expand Up @@ -254,7 +254,7 @@ public function testWithLicenceAlreadyInHeader(): void
'GPL-2.0-or-later'
);

self::assertEquals($expected, $actual);
self::assertEqualsRN($expected, $actual);
}


Expand Down Expand Up @@ -326,7 +326,7 @@ public function testWithTwoCommentsBeforeFirstCode()
);
}

self::assertEquals($expected, $contents);
self::assertEqualsRN($expected, $contents);
}

/**
Expand Down Expand Up @@ -380,7 +380,7 @@ public function testUnusualHeaderCommentStyle()
);
}

self::assertEquals($expected, $contents);
self::assertEqualsRN($expected, $contents);
}

/**
Expand Down Expand Up @@ -443,7 +443,7 @@ public function testCommentWithLicenseWord()
);
}

self::assertEquals($expected, $contents);
self::assertEqualsRN($expected, $contents);
}

/**
Expand Down Expand Up @@ -524,7 +524,7 @@ public function testIncorrectlyMatching()
'MIT'
);

self::assertEquals($expected, $actual);
self::assertEqualsRN($expected, $actual);
}

/**
Expand Down Expand Up @@ -573,6 +573,6 @@ public function testLicenseDetailsOnlyInsertedOncePerFile()
);
}

self::assertEquals($expected, $contents);
self::assertEqualsRN($expected, $contents);
}
}
Loading

0 comments on commit 3cb3317

Please sign in to comment.