Laravel 10 (#4706)
This commit is contained in:
parent
ad4ddc6300
commit
1d38b4f0e2
136 changed files with 1735 additions and 2008 deletions
|
@ -2,10 +2,7 @@
|
|||
|
||||
namespace Pterodactyl\Tests\Integration\Services\Databases;
|
||||
|
||||
use Mockery;
|
||||
use Mockery\MockInterface;
|
||||
use BadMethodCallException;
|
||||
use InvalidArgumentException;
|
||||
use Pterodactyl\Models\Database;
|
||||
use Pterodactyl\Models\DatabaseHost;
|
||||
use Pterodactyl\Tests\Integration\IntegrationTestCase;
|
||||
|
@ -79,7 +76,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
|||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('The database name passed to DatabaseManagementService::handle MUST be prefixed with "s{server_id}_".');
|
||||
|
||||
$this->getService()->create($server, $data);
|
||||
|
@ -134,13 +131,13 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
|||
// assertions that would get caught by the functions catcher and thus lead to the exception
|
||||
// being swallowed incorrectly.
|
||||
$this->repository->expects('createUser')->with(
|
||||
Mockery::on(function ($value) use (&$username) {
|
||||
\Mockery::on(function ($value) use (&$username) {
|
||||
$username = $value;
|
||||
|
||||
return true;
|
||||
}),
|
||||
'%',
|
||||
Mockery::on(function ($value) use (&$password) {
|
||||
\Mockery::on(function ($value) use (&$password) {
|
||||
$password = $value;
|
||||
|
||||
return true;
|
||||
|
@ -148,7 +145,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
|||
null
|
||||
);
|
||||
|
||||
$this->repository->expects('assignUserToDatabase')->with($name, Mockery::on(function ($value) use (&$secondUsername) {
|
||||
$this->repository->expects('assignUserToDatabase')->with($name, \Mockery::on(function ($value) use (&$secondUsername) {
|
||||
$secondUsername = $value;
|
||||
|
||||
return true;
|
||||
|
@ -182,11 +179,11 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
|||
|
||||
$host = DatabaseHost::factory()->create(['node_id' => $server->node_id]);
|
||||
|
||||
$this->repository->expects('createDatabase')->with($name)->andThrows(new BadMethodCallException());
|
||||
$this->repository->expects('createDatabase')->with($name)->andThrows(new \BadMethodCallException());
|
||||
$this->repository->expects('dropDatabase')->with($name);
|
||||
$this->repository->expects('dropUser')->withAnyArgs()->andThrows(new InvalidArgumentException());
|
||||
$this->repository->expects('dropUser')->withAnyArgs()->andThrows(new \InvalidArgumentException());
|
||||
|
||||
$this->expectException(BadMethodCallException::class);
|
||||
$this->expectException(\BadMethodCallException::class);
|
||||
|
||||
$this->getService()->create($server, [
|
||||
'remote' => '%',
|
||||
|
@ -197,7 +194,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
|||
$this->assertDatabaseMissing('databases', ['server_id' => $server->id]);
|
||||
}
|
||||
|
||||
public function invalidDataDataProvider(): array
|
||||
public static function invalidDataDataProvider(): array
|
||||
{
|
||||
return [
|
||||
[[]],
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
|
||||
namespace Pterodactyl\Tests\Integration\Services\Databases;
|
||||
|
||||
use Mockery;
|
||||
use Mockery\MockInterface;
|
||||
use Pterodactyl\Models\Node;
|
||||
use InvalidArgumentException;
|
||||
use Pterodactyl\Models\Database;
|
||||
use Pterodactyl\Models\DatabaseHost;
|
||||
use Pterodactyl\Tests\Integration\IntegrationTestCase;
|
||||
|
@ -24,7 +22,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->managementService = Mockery::mock(DatabaseManagementService::class);
|
||||
$this->managementService = \Mockery::mock(DatabaseManagementService::class);
|
||||
$this->swap(DatabaseManagementService::class, $this->managementService);
|
||||
}
|
||||
|
||||
|
@ -50,7 +48,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase
|
|||
{
|
||||
$server = $this->createServerModel();
|
||||
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessageMatches('/^Expected a non-empty value\. Got: /');
|
||||
$this->getService()->handle($server, $data);
|
||||
}
|
||||
|
@ -142,7 +140,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase
|
|||
$this->assertInstanceOf(Database::class, $response);
|
||||
}
|
||||
|
||||
public function invalidDataProvider(): array
|
||||
public static function invalidDataProvider(): array
|
||||
{
|
||||
return [
|
||||
[['remote' => '%']],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue