Skip to content

Commit

Permalink
fix unit test error
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed May 1, 2021
1 parent 9fcb2e0 commit 411b634
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/unit/Router/RouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function testAddRoutes(): void
$this->assertContains('name', $r1->getPathVars());
$this->assertContains('age', $r1->getPathVars());
$this->assertArrayHasKey('age', $r1->getBindVars());
$this->assertContains('GET /my[/{name}[/{age}]]', (string)$r1);
$this->assertStringContainsString('GET /my[/{name}[/{age}]]', (string)$r1);

foreach (Router::METHODS_ARRAY as $method) {
$r->$method("/$method", "handle_$method");
Expand All @@ -66,14 +66,14 @@ public function testAddRoutes(): void
$string = (string)$r;
foreach (Router::METHODS_ARRAY as $method) {
$s = sprintf('%-7s %-25s --> %s', $method, "/$method", "handle_$method");
$this->assertContains($s, $string);
$this->assertStringContainsString($s, $string);
}

$r->add('ANY', '/any', 'handler_any');
$string = $r->toString();
foreach (Router::METHODS_ARRAY as $method) {
$s = sprintf('%-7s %-25s --> %s', $method, '/any', 'handler_any');
$this->assertContains($s, $string);
$this->assertStringContainsString($s, $string);
}

$this->expectExceptionMessage('The method and route handler is not allow empty.');
Expand All @@ -82,7 +82,7 @@ public function testAddRoutes(): void
try {
$r->add('invalid', '/path', '/handler');
} catch (Throwable $e) {
$this->assertContains('The method [INVALID] is not supported', $e->getMessage());
$this->assertStringContainsString('The method [INVALID] is not supported', $e->getMessage());
}
}

Expand Down

0 comments on commit 411b634

Please sign in to comment.