Use more standardized phpcs

This commit is contained in:
Dane Everitt 2021-01-23 12:33:34 -08:00
parent a043071e3c
commit c449ca5155
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
493 changed files with 1116 additions and 3903 deletions

View file

@ -70,14 +70,16 @@ abstract class BrowserTestCase extends TestCase
*/
protected function driver()
{
$options = (new ChromeOptions)->addArguments([
$options = (new ChromeOptions())->addArguments([
'--disable-gpu',
'--disable-infobars',
]);
return RemoteWebDriver::create(
'http://host.pterodactyl.local:4444/wd/hub', DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY, $options
'http://host.pterodactyl.local:4444/wd/hub',
DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY,
$options
)
);
}
@ -86,6 +88,7 @@ abstract class BrowserTestCase extends TestCase
* Return an instance of the browser to be used for tests.
*
* @param \Facebook\WebDriver\Remote\RemoteWebDriver $driver
*
* @return \Pterodactyl\Tests\Browser\PterodactylBrowser
*/
protected function newBrowser($driver): PterodactylBrowser
@ -109,9 +112,6 @@ abstract class BrowserTestCase extends TestCase
/**
* Return a user model to authenticate aganist and use in the tests.
*
* @param array $attributes
* @return \Pterodactyl\Models\User
*/
protected function user(array $attributes = []): User
{

View file

@ -4,9 +4,6 @@ namespace Pterodactyl\Tests\Browser\Pages;
class LoginPage extends BasePage
{
/**
* @return string
*/
public function url(): string
{
return '/auth/login';

View file

@ -15,7 +15,7 @@ class ForgotPasswordProcessTest extends BrowserTestCase
public function testResetPasswordWithInvalidAccount()
{
$this->browse(function (PterodactylBrowser $browser) {
$browser->visit(new LoginPage)
$browser->visit(new LoginPage())
->assertSee(trans('auth.forgot_password.label'))
->click('@forgotPassword')
->waitForLocation('/auth/password')
@ -39,7 +39,7 @@ class ForgotPasswordProcessTest extends BrowserTestCase
public function testEmailCarryover()
{
$this->browse(function (PterodactylBrowser $browser) {
$browser->visit(new LoginPage)
$browser->visit(new LoginPage())
->type('@username', 'dane@example.com')
->click('@forgotPassword')
->waitForLocation('/auth/password')

View file

@ -27,7 +27,7 @@ class LoginProcessTest extends BrowserTestCase
public function testLoginUsingEmail()
{
$this->browse(function (PterodactylBrowser $browser) {
$browser->visit(new LoginPage)
$browser->visit(new LoginPage())
->waitFor('@username')
->type('@username', $this->user->email)
->type('@password', self::$userPassword)
@ -44,7 +44,7 @@ class LoginProcessTest extends BrowserTestCase
public function testLoginUsingUsername()
{
$this->browse(function (PterodactylBrowser $browser) {
$browser->visit(new LoginPage)
$browser->visit(new LoginPage())
->waitFor('@username')
->type('@username', $this->user->username)
->type('@password', self::$userPassword)

View file

@ -14,7 +14,7 @@ class AccountEmailProcessTest extends DashboardTestCase
{
$this->browse(function (PterodactylBrowser $browser) {
$browser->loginAs($this->user)
->visit(new AccountPage)
->visit(new AccountPage())
->assertValue('@email', $this->user->email)
->type('@email', 'new.email@example.com')
->type('@password', 'Password123')
@ -34,7 +34,7 @@ class AccountEmailProcessTest extends DashboardTestCase
{
$this->browse(function (PterodactylBrowser $browser) {
$browser->loginAs($this->user)
->visit(new AccountPage)
->visit(new AccountPage())
->assertMissing('@email ~ .input-help.error')
->type('@email', 'admin')
->assertVisible('@email ~ .input-help.error')
@ -51,7 +51,7 @@ class AccountEmailProcessTest extends DashboardTestCase
{
$this->browse(function (PterodactylBrowser $browser) {
$browser->loginAs($this->user)
->visit(new AccountPage)
->visit(new AccountPage())
->type('@email', 'new.email@example.com')
->click('@submit')
->assertFocused('@password')

View file

@ -14,7 +14,7 @@ class AccountPasswordProcessTest extends DashboardTestCase
{
$this->browse(function (PterodactylBrowser $browser) {
$browser->loginAs($this->user)
->visit(new AccountPage)
->visit(new AccountPage())
->type('@current_password', self::$userPassword)
->assertMissing('@new_password ~ .input-help.error')
->type('@new_password', 'test')
@ -42,7 +42,7 @@ class AccountPasswordProcessTest extends DashboardTestCase
{
$this->browse(function (PterodactylBrowser $browser) {
$browser->loginAs($this->user)
->visit(new AccountPage)
->visit(new AccountPage())
->type('@current_password', 'badpassword')
->type('@new_password', 'testtest')
->type('@confirm_password', 'testtest')

View file

@ -17,7 +17,7 @@ class TwoFactorAuthenticationProcessTest extends DashboardTestCase
{
$this->browse(function (PterodactylBrowser $browser) {
$browser->loginAs($this->user)
->visit(new AccountPage)
->visit(new AccountPage())
->assertMissing('.modal-mask')
->click('@2fa_button')
->waitFor('@2fa_modal')
@ -42,7 +42,7 @@ class TwoFactorAuthenticationProcessTest extends DashboardTestCase
{
$this->browse(function (PterodactylBrowser $browser) {
$browser->loginAs($this->user)
->visit(new AccountPage)
->visit(new AccountPage())
->click('@2fa_button')
->waitForText(trans('dashboard/account.two_factor.setup.title'))
->assertFocused('@2fa_token')
@ -76,7 +76,7 @@ class TwoFactorAuthenticationProcessTest extends DashboardTestCase
*/
public function testTwoFactorCanBeDisabled()
{
$secret = (new Google2FA)->generateSecretKey(16);
$secret = (new Google2FA())->generateSecretKey(16);
$this->user->update([
'use_totp' => true,
@ -85,7 +85,7 @@ class TwoFactorAuthenticationProcessTest extends DashboardTestCase
$this->browse(function (PterodactylBrowser $browser) use ($secret) {
$browser->loginAs($this->user)
->visit(new AccountPage)
->visit(new AccountPage())
->click('@2fa_button')
->waitForText(trans('dashboard/account.two_factor.disable.title'))
->click('@2fa_cancel')

View file

@ -11,8 +11,6 @@ class PterodactylBrowser extends Browser
/**
* Move the mouse to a specific location and then perform a left click action.
*
* @param int $x
* @param int $y
* @return $this
*/
public function clickPosition(int $x, int $y)
@ -26,6 +24,7 @@ class PterodactylBrowser extends Browser
* Perform a case insensitive search for a string in the body.
*
* @param string $text
*
* @return \Pterodactyl\Tests\Browser\PterodactylBrowser
*/
public function assertSee($text)
@ -38,6 +37,7 @@ class PterodactylBrowser extends Browser
*
* @param string $selector
* @param string $text
*
* @return \Pterodactyl\Tests\Browser\PterodactylBrowser
*/
public function assertSeeIn($selector, $text)