Skip to content

Commit f1c1699

Browse files
committed
Fix tests with model events
1 parent 2fc5a73 commit f1c1699

File tree

3 files changed

+7
-25
lines changed

3 files changed

+7
-25
lines changed

database/Factories/AllocationFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function definition(): array
2222
{
2323
return [
2424
'ip' => $this->faker->unique()->ipv4,
25-
'port' => $this->faker->unique()->randomNumber(5),
25+
'port' => $this->faker->unique()->numberBetween(10000, 20000),
2626
];
2727
}
2828

database/Factories/ServerFactory.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ public function definition()
3838
'cpu' => 0,
3939
'threads' => null,
4040
'oom_disabled' => 0,
41-
'allocation_limit' => null,
42-
'database_limit' => null,
41+
'startup' => '/bin/bash echo "hello world"',
42+
'image' => 'foo/bar:latest',
43+
'allocation_limit' => 0,
44+
'database_limit' => 0,
45+
'backup_limit' => 0,
4346
'created_at' => Carbon::now(),
4447
'updated_at' => Carbon::now(),
4548
];

tests/Integration/IntegrationTestCase.php

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,14 @@
44

55
use Carbon\CarbonImmutable;
66
use Pterodactyl\Tests\TestCase;
7-
use Illuminate\Database\Eloquent\Model;
87
use Pterodactyl\Tests\Traits\Integration\CreatesTestModels;
98
use Pterodactyl\Transformers\Api\Application\BaseTransformer;
109

1110
abstract class IntegrationTestCase extends TestCase
1211
{
1312
use CreatesTestModels;
1413

15-
/**
16-
* Setup base integration test cases.
17-
*/
18-
public function setUp(): void
19-
{
20-
parent::setUp();
21-
22-
// Disable event dispatcher to prevent eloquence from trying to
23-
// perform validation on models going into the database. If this is
24-
// not disabled, eloquence validation errors get swallowed and
25-
// the tests cannot complete because nothing is put into the database.
26-
Model::unsetEventDispatcher();
27-
}
28-
29-
/**
30-
* @return array
31-
*/
32-
protected function connectionsToTransact()
33-
{
34-
return ['testing'];
35-
}
14+
protected array $connectionsToTransact = ['mysql'];
3615

3716
/**
3817
* Return an ISO-8601 formatted timestamp to use in the API response.

0 commit comments

Comments
 (0)