Skip to content
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

add AsyncMysqlQueryErrorResult and SQLFakeAsyncMysqlException #110

Merged
merged 6 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/AsyncMysql/AsyncMysqlQueryErrorResult.hack
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace Slack\SQLFake;

<<__MockClass>>
final class AsyncMysqlQueryErrorResult extends \AsyncMysqlQueryErrorResult {

/* HH_IGNORE_ERROR[3012] I don't want to call parent::construct */
public function __construct(private int $mysql_errno = 1105, private string $mysql_error = 'ERUnknownError') {}

Comment on lines +6 to +8
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think we can get away with calling the parent constructor here and removing the ignore:

parent::__construct();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't do that here because the parent constructor is a private method [FATAL] E_FATAL: Call to private method AsyncMysqlQueryErrorResult::__construct()

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢

<<__Override>>
// HHAST_IGNORE_ERROR[CamelCasedMethodsUnderscoredFunctions]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need this because the parent method is not camel cased

public function mysql_errno(): int {
return $this->mysql_errno;
}

<<__Override>>
// HHAST_IGNORE_ERROR[CamelCasedMethodsUnderscoredFunctions]
public function mysql_error(): string {
return $this->mysql_error;
}
}
8 changes: 8 additions & 0 deletions src/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ final class SQLFakeParseException extends SQLFakeException {}
final class SQLFakeRuntimeException extends SQLFakeException {}
final class SQLFakeUniqueKeyViolation extends SQLFakeException {}
final class SQLFakeVitessQueryViolation extends SQLFakeException {}
final class SQLFakeAsyncMysqlException extends SQLFakeException {
public function __construct(private \AsyncMysqlErrorResult $result) {
parent::__construct();
}
public function getResult(): \AsyncMysqlErrorResult {
return $this->result;
}
}
Loading