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 2de8439 commit 0214904
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/db/test/unit/Eloquent/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -780,14 +780,14 @@ public function testProp()

$expectSql = '`user_desc` = ?';
$sql = User::whereProp('udesc', $desc)->toSql();
$this->assertContains($expectSql, $sql);
$this->assertStringContainsString($expectSql, $sql);

$expectSql1 = 'select * from `user` where (`user_desc` = ? and `test_json`->\'$."user_status"\' = ?)';
$sql1 = User::whereProp([
'udesc' => $desc,
'test_json->user_status' => $rand
])->toSql();
$this->assertContains($expectSql1, $sql1);
$this->assertStringContainsString($expectSql1, $sql1);
}

public function testUpdateOrCreate()
Expand Down
8 changes: 4 additions & 4 deletions src/http-server/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
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function assertErrorMessage(string $message): void
}

$errorMessage = $error->getMessage();
Assert::assertContains($message, $errorMessage);
Assert::assertStringContainsString($message, $errorMessage);
}

/**
Expand Down

0 comments on commit 0214904

Please sign in to comment.