We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -337,8 +337,8 @@ |
||
| 337 | 337 | foreach (Globals::getAvailableTemplates() as $Template) { |
| 338 | 338 | foreach (Globals::getAvailableColourSchemes($Template) as $ColourScheme) { |
| 339 | 339 | $selected = ($ThisAccount->getTemplate() == $Template && |
| 340 | - $ThisAccount->getColourScheme() == $ColourScheme && |
|
| 341 | - $ThisAccount->isDefaultCSSEnabled()) ? 'selected' : ''; |
|
| 340 | + $ThisAccount->getColourScheme() == $ColourScheme && |
|
| 341 | + $ThisAccount->isDefaultCSSEnabled()) ? 'selected' : ''; |
|
| 342 | 342 | $name = $Template . ' - ' . $ColourScheme; |
| 343 | 343 | ?><option value="<?php echo $name; ?>" <?php echo $selected; ?>><?php echo $name; ?></option><?php |
| 344 | 344 | } |
@@ -150,7 +150,7 @@ |
||
| 150 | 150 | $account->increaseSmrRewardCredits(2 * CREDITS_PER_DOLLAR); // Give $2 worth of "reward" credits for joining. |
| 151 | 151 | if ($socialLogin) { |
| 152 | 152 | $account->addAuthMethod($_SESSION['socialLogin']->getLoginType(), |
| 153 | - $_SESSION['socialLogin']->getUserID()); |
|
| 153 | + $_SESSION['socialLogin']->getUserID()); |
|
| 154 | 154 | if ($validatedBySocial) { |
| 155 | 155 | $account->setValidated(true); |
| 156 | 156 | $account->update(); |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | //heres the AIs cards |
| 97 | 97 | $i = 1; |
| 98 | 98 | if ($dealerHand->hasBlackjack() || |
| 99 | - ($playerHand->getValue() > 21 && $dealerHand->getValue() <= 21)) { |
|
| 99 | + ($playerHand->getValue() > 21 && $dealerHand->getValue() <= 21)) { |
|
| 100 | 100 | $message .= ('<h1 class="red center">Bank Wins</h1>'); |
| 101 | 101 | } |
| 102 | 102 | $message .= ('<div class="center">Bank\'s Cards are</div><br /><table class="center"><tr>'); |
@@ -44,8 +44,8 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | public function getValue() : int { |
| 46 | 46 | if ($this->rank == self::RANK_JACK || |
| 47 | - $this->rank == self::RANK_QUEEN || |
|
| 48 | - $this->rank == self::RANK_KING) { |
|
| 47 | + $this->rank == self::RANK_QUEEN || |
|
| 48 | + $this->rank == self::RANK_KING) { |
|
| 49 | 49 | return 10; |
| 50 | 50 | } elseif ($this->isAce()) { |
| 51 | 51 | return 11; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | foreach (\Globals::getGoods() as $goodId => $value) { |
| 94 | 94 | if ($goods[$goodId] === true) { |
| 95 | 95 | if ($sectors[$currentSectorId]->getPort()->getGoodTransaction($goodId) === self::GOOD_SELLS && |
| 96 | - $sectors[$targetSectorId]->getPort()->getGoodTransaction($goodId) === self::GOOD_BUYS) { |
|
| 96 | + $sectors[$targetSectorId]->getPort()->getGoodTransaction($goodId) === self::GOOD_BUYS) { |
|
| 97 | 97 | $rl[] = new OneWayRoute($currentSectorId, $targetSectorId, $raceID, $sectors[$targetSectorId]->getPort()->getRaceID(), $sectors[$currentSectorId]->getPort()->getGoodDistance($goodId), $sectors[$targetSectorId]->getPort()->getGoodDistance($goodId), $distance, $goodId); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | foreach (\Globals::getGoods() as $goodId => $value) { |
| 122 | 122 | if ($goods[$goodId] === true) { |
| 123 | 123 | if ($sectors[$currentSectorId]->getPort()->getGoodTransaction($goodId) === self::GOOD_SELLS && |
| 124 | - $sectors[$targetSectorId]->getPort()->getGoodTransaction($goodId) === self::GOOD_BUYS) { |
|
| 124 | + $sectors[$targetSectorId]->getPort()->getGoodTransaction($goodId) === self::GOOD_BUYS) { |
|
| 125 | 125 | $owr = new OneWayRoute($currentSectorId, $targetSectorId, $sectors[$currentSectorId]->getPort()->getRaceID(), $sectors[$targetSectorId]->getPort()->getRaceID(), $sectors[$currentSectorId]->getPort()->getGoodDistance($goodId), $sectors[$targetSectorId]->getPort()->getGoodDistance($goodId), $distance, $goodId); |
| 126 | 126 | $fakeReturn = new OneWayRoute($targetSectorId, $currentSectorId, $sectors[$targetSectorId]->getPort()->getRaceID(), $sectors[$currentSectorId]->getPort()->getRaceID(), 0, 0, $distance, GOODS_NOTHING); |
| 127 | 127 | $mpr = new MultiplePortRoute($owr, $fakeReturn); |
@@ -6,30 +6,30 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | class Record |
| 8 | 8 | { |
| 9 | - public int $account_id = 1; |
|
| 10 | - public string $login = "login"; |
|
| 11 | - public string $password = "password"; |
|
| 12 | - public string $email = "email"; |
|
| 13 | - public string $last_login = "last login"; |
|
| 14 | - public string $validation_code = "validation code"; |
|
| 15 | - public string $offset = "offset"; |
|
| 16 | - public string $images = "Yes"; |
|
| 17 | - public string $fontsize = "font size"; |
|
| 18 | - public string $password_reset = "password reset"; |
|
| 19 | - public int $mail_banned = 0; |
|
| 20 | - public string $friendly_colour = "colour"; |
|
| 21 | - public string $neutral_colour = "colour"; |
|
| 22 | - public string $enemy_colour = "colour"; |
|
| 23 | - public string $css_link = "css link"; |
|
| 24 | - public string $referral_id = 'referral_id'; |
|
| 25 | - public string $max_rank_achieved = 'max_rank_achieved'; |
|
| 26 | - public string $hof_name = 'hof_name'; |
|
| 27 | - public string $discord_id = 'discord_id'; |
|
| 28 | - public string $irc_nick = 'irc_nick'; |
|
| 29 | - public string $date_short = 'date_short'; |
|
| 30 | - public string $time_short = 'time_short'; |
|
| 31 | - public string $template = 'template'; |
|
| 32 | - public string $colour_scheme = 'colour_scheme'; |
|
| 9 | + public int $account_id = 1; |
|
| 10 | + public string $login = "login"; |
|
| 11 | + public string $password = "password"; |
|
| 12 | + public string $email = "email"; |
|
| 13 | + public string $last_login = "last login"; |
|
| 14 | + public string $validation_code = "validation code"; |
|
| 15 | + public string $offset = "offset"; |
|
| 16 | + public string $images = "Yes"; |
|
| 17 | + public string $fontsize = "font size"; |
|
| 18 | + public string $password_reset = "password reset"; |
|
| 19 | + public int $mail_banned = 0; |
|
| 20 | + public string $friendly_colour = "colour"; |
|
| 21 | + public string $neutral_colour = "colour"; |
|
| 22 | + public string $enemy_colour = "colour"; |
|
| 23 | + public string $css_link = "css link"; |
|
| 24 | + public string $referral_id = 'referral_id'; |
|
| 25 | + public string $max_rank_achieved = 'max_rank_achieved'; |
|
| 26 | + public string $hof_name = 'hof_name'; |
|
| 27 | + public string $discord_id = 'discord_id'; |
|
| 28 | + public string $irc_nick = 'irc_nick'; |
|
| 29 | + public string $date_short = 'date_short'; |
|
| 30 | + public string $time_short = 'time_short'; |
|
| 31 | + public string $template = 'template'; |
|
| 32 | + public string $colour_scheme = 'colour_scheme'; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -39,63 +39,63 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | class AbstractSmrAccountTest extends TestCase |
| 41 | 41 | { |
| 42 | - private AbstractSmrAccount $abstractSmrAccount; |
|
| 42 | + private AbstractSmrAccount $abstractSmrAccount; |
|
| 43 | 43 | |
| 44 | - public function testGetAccountByAccountId() |
|
| 45 | - { |
|
| 46 | - //# Given the database has been set up with a user |
|
| 47 | - $record = new Record(); |
|
| 48 | - self::setupMockMysqlDatabase($record); |
|
| 49 | - //# And there is no force update |
|
| 50 | - $forceUpdate = false; |
|
| 51 | - //# When the account is retrieved by its ID |
|
| 52 | - $this->abstractSmrAccount = AbstractSmrAccount::getAccount($record->account_id, $forceUpdate); |
|
| 53 | - //# Then the integrity of the user is correct |
|
| 54 | - $this->assertEquals($record->account_id, $this->abstractSmrAccount->getAccountID()); |
|
| 55 | - $this->assertEquals($record->login, $this->abstractSmrAccount->getLogin()); |
|
| 56 | - $this->assertEquals($record->email, $this->abstractSmrAccount->getEmail()); |
|
| 57 | - $this->assertEquals($record->last_login, $this->abstractSmrAccount->getLastLogin()); |
|
| 58 | - $this->assertEquals($record->validation_code, $this->abstractSmrAccount->getValidationCode()); |
|
| 59 | - $this->assertEquals($record->offset, $this->abstractSmrAccount->getOffset()); |
|
| 60 | - $this->assertEquals(true, $this->abstractSmrAccount->isDisplayShipImages()); |
|
| 61 | - $this->assertEquals($record->fontsize, $this->abstractSmrAccount->getFontSize()); |
|
| 62 | - $this->assertEquals($record->password_reset, $this->abstractSmrAccount->getPasswordReset()); |
|
| 63 | - $this->assertEquals($record->mail_banned, $this->abstractSmrAccount->getMailBanned()); |
|
| 64 | - $this->assertEquals($record->friendly_colour, $this->abstractSmrAccount->getFriendlyColour()); |
|
| 65 | - $this->assertEquals($record->neutral_colour, $this->abstractSmrAccount->getNeutralColour()); |
|
| 66 | - $this->assertEquals($record->enemy_colour, $this->abstractSmrAccount->getEnemyColour()); |
|
| 67 | - $this->assertEquals($record->css_link, $this->abstractSmrAccount->getCssLink()); |
|
| 68 | - $this->assertEquals($record->referral_id, $this->abstractSmrAccount->getReferrerID()); |
|
| 69 | - $this->assertEquals($record->hof_name, $this->abstractSmrAccount->getHofName()); |
|
| 70 | - $this->assertEquals($record->discord_id, $this->abstractSmrAccount->getDiscordId()); |
|
| 71 | - $this->assertEquals($record->irc_nick, $this->abstractSmrAccount->getIrcNick()); |
|
| 72 | - $this->assertEquals($record->date_short, $this->abstractSmrAccount->getShortDateFormat()); |
|
| 73 | - $this->assertEquals($record->time_short, $this->abstractSmrAccount->getShortTimeFormat()); |
|
| 74 | - $this->assertEquals($record->template, $this->abstractSmrAccount->getTemplate()); |
|
| 75 | - } |
|
| 44 | + public function testGetAccountByAccountId() |
|
| 45 | + { |
|
| 46 | + //# Given the database has been set up with a user |
|
| 47 | + $record = new Record(); |
|
| 48 | + self::setupMockMysqlDatabase($record); |
|
| 49 | + //# And there is no force update |
|
| 50 | + $forceUpdate = false; |
|
| 51 | + //# When the account is retrieved by its ID |
|
| 52 | + $this->abstractSmrAccount = AbstractSmrAccount::getAccount($record->account_id, $forceUpdate); |
|
| 53 | + //# Then the integrity of the user is correct |
|
| 54 | + $this->assertEquals($record->account_id, $this->abstractSmrAccount->getAccountID()); |
|
| 55 | + $this->assertEquals($record->login, $this->abstractSmrAccount->getLogin()); |
|
| 56 | + $this->assertEquals($record->email, $this->abstractSmrAccount->getEmail()); |
|
| 57 | + $this->assertEquals($record->last_login, $this->abstractSmrAccount->getLastLogin()); |
|
| 58 | + $this->assertEquals($record->validation_code, $this->abstractSmrAccount->getValidationCode()); |
|
| 59 | + $this->assertEquals($record->offset, $this->abstractSmrAccount->getOffset()); |
|
| 60 | + $this->assertEquals(true, $this->abstractSmrAccount->isDisplayShipImages()); |
|
| 61 | + $this->assertEquals($record->fontsize, $this->abstractSmrAccount->getFontSize()); |
|
| 62 | + $this->assertEquals($record->password_reset, $this->abstractSmrAccount->getPasswordReset()); |
|
| 63 | + $this->assertEquals($record->mail_banned, $this->abstractSmrAccount->getMailBanned()); |
|
| 64 | + $this->assertEquals($record->friendly_colour, $this->abstractSmrAccount->getFriendlyColour()); |
|
| 65 | + $this->assertEquals($record->neutral_colour, $this->abstractSmrAccount->getNeutralColour()); |
|
| 66 | + $this->assertEquals($record->enemy_colour, $this->abstractSmrAccount->getEnemyColour()); |
|
| 67 | + $this->assertEquals($record->css_link, $this->abstractSmrAccount->getCssLink()); |
|
| 68 | + $this->assertEquals($record->referral_id, $this->abstractSmrAccount->getReferrerID()); |
|
| 69 | + $this->assertEquals($record->hof_name, $this->abstractSmrAccount->getHofName()); |
|
| 70 | + $this->assertEquals($record->discord_id, $this->abstractSmrAccount->getDiscordId()); |
|
| 71 | + $this->assertEquals($record->irc_nick, $this->abstractSmrAccount->getIrcNick()); |
|
| 72 | + $this->assertEquals($record->date_short, $this->abstractSmrAccount->getShortDateFormat()); |
|
| 73 | + $this->assertEquals($record->time_short, $this->abstractSmrAccount->getShortTimeFormat()); |
|
| 74 | + $this->assertEquals($record->template, $this->abstractSmrAccount->getTemplate()); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - private static function setupMockMysqlDatabase(Record $record): MockInterface |
|
| 78 | - { |
|
| 79 | - //# Force the mock to be used in the autoloader |
|
| 80 | - $mysqlDatabase = m::mock("overload:SmrMySqlDatabase"); |
|
| 81 | - $mysqlDatabase |
|
| 82 | - ->shouldReceive("escapeNumber") |
|
| 83 | - ->with($record->account_id) |
|
| 84 | - ->andReturn($record->account_id); |
|
| 85 | - $mysqlDatabase |
|
| 86 | - ->shouldReceive("query"); |
|
| 87 | - $mysqlDatabase |
|
| 88 | - ->shouldReceive("nextRecord") |
|
| 89 | - ->andReturn("a record"); |
|
| 90 | - $mysqlDatabase |
|
| 91 | - ->shouldReceive("getRow") |
|
| 92 | - ->andReturn((array)$record); |
|
| 93 | - $mysqlDatabase |
|
| 94 | - ->shouldReceive("getBoolean") |
|
| 95 | - ->andReturn(false); |
|
| 96 | - $mysqlDatabase |
|
| 97 | - ->shouldReceive("getObject") |
|
| 98 | - ->andReturn(array()); |
|
| 99 | - return $mysqlDatabase; |
|
| 100 | - } |
|
| 77 | + private static function setupMockMysqlDatabase(Record $record): MockInterface |
|
| 78 | + { |
|
| 79 | + //# Force the mock to be used in the autoloader |
|
| 80 | + $mysqlDatabase = m::mock("overload:SmrMySqlDatabase"); |
|
| 81 | + $mysqlDatabase |
|
| 82 | + ->shouldReceive("escapeNumber") |
|
| 83 | + ->with($record->account_id) |
|
| 84 | + ->andReturn($record->account_id); |
|
| 85 | + $mysqlDatabase |
|
| 86 | + ->shouldReceive("query"); |
|
| 87 | + $mysqlDatabase |
|
| 88 | + ->shouldReceive("nextRecord") |
|
| 89 | + ->andReturn("a record"); |
|
| 90 | + $mysqlDatabase |
|
| 91 | + ->shouldReceive("getRow") |
|
| 92 | + ->andReturn((array)$record); |
|
| 93 | + $mysqlDatabase |
|
| 94 | + ->shouldReceive("getBoolean") |
|
| 95 | + ->andReturn(false); |
|
| 96 | + $mysqlDatabase |
|
| 97 | + ->shouldReceive("getObject") |
|
| 98 | + ->andReturn(array()); |
|
| 99 | + return $mysqlDatabase; |
|
| 100 | + } |
|
| 101 | 101 | } |