Skip to content

Commit

Permalink
[tests] 🆙 Replace assertInternalType() assertion with specialized ones
Browse files Browse the repository at this point in the history
  • Loading branch information
nelson6e65 committed Jan 16, 2019
1 parent 6fa7d56 commit 0a806b2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions tests/Helpers/IComparableTester.php
Expand Up @@ -81,7 +81,7 @@ public function testIComparableCompareToMethod($expected, IComparable $left, $ri
);

if ($expected === 0) {
$this->assertInternalType('integer', $actual, $message);
$this->assertIsInt($actual, $message);
$this->assertEquals(0, $actual, $message);
} else {
if ($expected === null) {
Expand All @@ -95,7 +95,7 @@ public function testIComparableCompareToMethod($expected, IComparable $left, $ri
$major = $actual;
}

$this->assertInternalType('integer', $actual, $message);
$this->assertIsInt($actual, $message);
$this->assertGreaterThan($minor, $major, $message);
$this->assertLessThan($major, $minor, $message);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Helpers/IComparerTester.php
Expand Up @@ -92,7 +92,7 @@ public function testCompareMethod($expected, $left, $right) : void
);

if ($expected === 0) {
$this->assertInternalType('integer', $actual, $message);
$this->assertIsInt($actual, $message);
$this->assertEquals(0, $actual, $message);
} else {
if ($expected === null) {
Expand All @@ -106,7 +106,7 @@ public function testCompareMethod($expected, $left, $right) : void
$major = $actual;
}

$this->assertInternalType('integer', $actual, $message);
$this->assertIsInt($actual, $message);
$this->assertGreaterThan($minor, $major, $message);
$this->assertLessThan($major, $minor, $message);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Helpers/IEquatableTester.php
Expand Up @@ -82,7 +82,7 @@ public function testIEquatableEqualsMethod($expected, IEquatable $left, $right)
]
);

$this->assertInternalType('boolean', $actual, $message);
$this->assertIsBool($actual, $message);

if (!is_bool($expected)) {
throw new InvalidArgumentException(Text::format(
Expand Down
16 changes: 8 additions & 8 deletions tests/TestCase/TypeTest.php
Expand Up @@ -214,8 +214,8 @@ public function testGetInterfaces($obj, array $interfaces) : void
$reflections = $type->getInterfaces(true);
$strings = $type->getInterfaces();

$this->assertInternalType('array', $reflections);
$this->assertInternalType('array', $strings);
$this->assertIsArray($reflections);
$this->assertIsArray($strings);

$this->assertCount(count($interfaces), $reflections);
$this->assertCount(count($interfaces), $strings);
Expand Down Expand Up @@ -247,8 +247,8 @@ public function testGetExplicitTraitsInClass($obj, array $traits) : void
$reflections = $type->getTraits(true);
$strings = $type->getTraits();

$this->assertInternalType('array', $reflections);
$this->assertInternalType('array', $strings);
$this->assertIsArray($reflections);
$this->assertIsArray($strings);

$this->assertEquals(count($strings), count($reflections), 'Not same count for strings and reflections');
$this->assertCount(count($traits), $reflections);
Expand Down Expand Up @@ -281,8 +281,8 @@ public function testGetAllRecursiveTraitsInClass($obj, array $traits) : void
$reflections = $type->getTraits(true, true);
$strings = $type->getTraits(false, true);

$this->assertInternalType('array', $reflections);
$this->assertInternalType('array', $strings);
$this->assertIsArray($reflections);
$this->assertIsArray($strings);

$this->assertEquals(count($strings), count($reflections), 'Not same count for strings and reflections');
$this->assertCount(count($traits), $reflections);
Expand Down Expand Up @@ -317,7 +317,7 @@ public function testCanCheckIfTypeHasProperty($obj, string $name) : void

$actual = $type->hasProperty($name);

$this->assertInternalType('bool', $actual, 'This method must return a boolean');
$this->assertIsBool($actual, 'This method must return a boolean');

$this->assertTrue($actual);
}
Expand All @@ -341,7 +341,7 @@ public function testCanCheckIfTypeHasNotProperty($obj, string $name) : void

$actual = $type->hasProperty($name);

$this->assertInternalType('bool', $actual, 'This method must return a boolean');
$this->assertIsBool($actual, 'This method must return a boolean');

$this->assertFalse($actual);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/VersionComponentTest.php
Expand Up @@ -106,7 +106,7 @@ public function testCanCheckIfVersionComponentIsInDefaultOrNullState(

foreach ($actuals as $method => $actual) {
// Pre-tests for returning type
$this->assertInternalType('boolean', $actual, $messages[$method].' # Should return a boolean #');
$this->assertIsBool($actual, $messages[$method].' # Should return a boolean #');
}

// Pre-tests for different values
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/VersionTest.php
Expand Up @@ -72,7 +72,7 @@ public function testIsValid(bool $expected, Version $version) : void
]
);

$this->assertInternalType('boolean', $actual, $message.' # Should return a boolean #');
$this->assertIsBool($actual, $message.' # Should return a boolean #');

if ($expected === true) {
$this->assertTrue($actual, $message);
Expand Down

0 comments on commit 0a806b2

Please sign in to comment.