-
Notifications
You must be signed in to change notification settings - Fork 3
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
Let assertEquals be strict assertSame #5
Open
peter279k
wants to merge
1
commit into
linna:master
Choose a base branch
from
peter279k:improve_assertion
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,4 +32,4 @@ jobs: | |
run: composer install | ||
|
||
- name: Execute tests | ||
run: vendor/bin/phpunit --verbose | ||
run: vendor/bin/phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,14 +36,14 @@ public function testNewInstance(): void | |
$uri = new Uri(self::$uri); | ||
|
||
$this->assertInstanceOf(Uri::class, $uri); | ||
$this->assertEquals('http', $uri->getScheme()); | ||
$this->assertEquals('username:password', $uri->getUserInfo()); | ||
$this->assertEquals('hostname.com', $uri->getHost()); | ||
$this->assertEquals(9090, $uri->getPort()); | ||
$this->assertEquals('username:[email protected]:9090', $uri->getAuthority()); | ||
$this->assertEquals('/path', $uri->getPath()); | ||
$this->assertEquals('arg=value', $uri->getQuery()); | ||
$this->assertEquals('anchor', $uri->getFragment()); | ||
$this->assertSame('http', $uri->getScheme()); | ||
$this->assertSame('username:password', $uri->getUserInfo()); | ||
$this->assertSame('hostname.com', $uri->getHost()); | ||
$this->assertSame(9090, $uri->getPort()); | ||
$this->assertSame('username:[email protected]:9090', $uri->getAuthority()); | ||
$this->assertSame('/path', $uri->getPath()); | ||
$this->assertSame('arg=value', $uri->getQuery()); | ||
$this->assertSame('anchor', $uri->getFragment()); | ||
} | ||
|
||
/** | ||
|
@@ -118,7 +118,7 @@ public function authorityProvider(): array | |
*/ | ||
public function testGetAuthority(string $autority, string $expected): void | ||
{ | ||
$this->assertEquals($expected, (new Uri("{$autority}/path?arg=value#anchor"))->getAuthority()); | ||
$this->assertSame($expected, (new Uri("{$autority}/path?arg=value#anchor"))->getAuthority()); | ||
} | ||
|
||
/** | ||
|
@@ -146,7 +146,7 @@ public function portProvider(): array | |
*/ | ||
public function testGetPort(string $scheme, string $port, int $expected): void | ||
{ | ||
$this->assertEquals($expected, (new Uri("{$scheme}://username:[email protected]{$port}/path?arg=value#anchor"))->getPort()); | ||
$this->assertSame($expected, (int)(new Uri("{$scheme}://username:[email protected]{$port}/path?arg=value#anchor"))->getPort()); | ||
} | ||
|
||
/** | ||
|
@@ -158,7 +158,7 @@ public function testWithScheme(): void | |
{ | ||
$uri = (new Uri(self::$uri))->withScheme('https'); | ||
|
||
$this->assertEquals('https', $uri->getScheme()); | ||
$this->assertSame('https', $uri->getScheme()); | ||
} | ||
|
||
/** | ||
|
@@ -196,7 +196,7 @@ public function testWithUserInfo(): void | |
{ | ||
$uri = (new Uri(self::$uri))->withUserInfo('testUser', 'password'); | ||
|
||
$this->assertEquals('testUser:password', $uri->getUserInfo()); | ||
$this->assertSame('testUser:password', $uri->getUserInfo()); | ||
} | ||
|
||
/** | ||
|
@@ -208,7 +208,7 @@ public function testWithUserInfoWithoutPassword(): void | |
{ | ||
$uri = (new Uri(self::$uri))->withUserInfo('testUser'); | ||
|
||
$this->assertEquals('testUser', $uri->getUserInfo()); | ||
$this->assertSame('testUser', $uri->getUserInfo()); | ||
} | ||
|
||
/** | ||
|
@@ -220,7 +220,7 @@ public function testWithUserInfoWithoutUserAndPassword(): void | |
{ | ||
$uri = (new Uri(self::$uri))->withUserInfo(''); | ||
|
||
$this->assertEquals('', $uri->getUserInfo()); | ||
$this->assertSame('', $uri->getUserInfo()); | ||
} | ||
|
||
/** | ||
|
@@ -232,7 +232,7 @@ public function testWithHost(): void | |
{ | ||
$uri = (new Uri(self::$uri))->withHost('example.com'); | ||
|
||
$this->assertEquals('example.com', $uri->getHost()); | ||
$this->assertSame('example.com', $uri->getHost()); | ||
} | ||
|
||
/** | ||
|
@@ -270,7 +270,7 @@ public function testWithPort(): void | |
{ | ||
$uri = (new Uri(self::$uri))->withPort(8080); | ||
|
||
$this->assertEquals(8080, $uri->getPort()); | ||
$this->assertSame(8080, $uri->getPort()); | ||
} | ||
|
||
/** | ||
|
@@ -356,8 +356,8 @@ public function testWithPath(): void | |
{ | ||
$uri = (new Uri(self::$uri))->withPath('/otherpath'); | ||
|
||
$this->assertEquals('/otherpath', $uri->getPath()); | ||
$this->assertEquals('http://username:[email protected]:9090/otherpath?arg=value#anchor', (string) $uri); | ||
$this->assertSame('/otherpath', $uri->getPath()); | ||
$this->assertSame('http://username:[email protected]:9090/otherpath?arg=value#anchor', (string) $uri); | ||
} | ||
|
||
/** | ||
|
@@ -432,7 +432,7 @@ public function uriProvider(): array | |
*/ | ||
public function testUriToString(string $testUri): void | ||
{ | ||
$this->assertEquals($testUri, (string) (new Uri($testUri))); | ||
$this->assertSame($testUri, (string) (new Uri($testUri))); | ||
} | ||
|
||
/** | ||
|
@@ -464,8 +464,8 @@ public function testWithQuery(string $withQuery, string $expectedQuery, string $ | |
{ | ||
$uri = (new Uri(self::$uri))->withQuery($withQuery); | ||
|
||
$this->assertEquals($expectedQuery, $uri->getQuery()); | ||
$this->assertEquals($expectedUri, (string) $uri); | ||
$this->assertSame($expectedQuery, $uri->getQuery()); | ||
$this->assertSame($expectedUri, (string) $uri); | ||
} | ||
|
||
/** | ||
|
@@ -523,8 +523,8 @@ public function testWithFragment(string $withFragment, string $expectedFragment, | |
{ | ||
$uri = (new Uri(self::$uri))->withFragment($withFragment); | ||
|
||
$this->assertEquals($expectedFragment, $uri->getFragment()); | ||
$this->assertEquals($expectedUri, (string) $uri); | ||
$this->assertSame($expectedFragment, $uri->getFragment()); | ||
$this->assertSame($expectedUri, (string) $uri); | ||
} | ||
|
||
/** | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the data providers, the
set#0
andset#4
will returnnull
when calling theUri::getPort
method.It should casting the
null
to be0
when asserting the above two test data.