Skip to content

Commit b9eb87d

Browse files
committed
Fix node and schedule unit tests
1 parent 0c2bd41 commit b9eb87d

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

tests/Unit/Services/Nodes/NodeDeletionServiceTest.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
<?php
2-
/**
3-
* Pterodactyl - Panel
4-
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
5-
*
6-
* This software is licensed under the terms of the MIT license.
7-
* https://opensource.org/licenses/MIT
8-
*/
92

103
namespace Tests\Unit\Services\Nodes;
114

@@ -90,7 +83,7 @@ public function testExceptionIsThrownIfServersAreAttachedToNode()
9083
*/
9184
public function testModelCanBePassedToFunctionInPlaceOfNodeId()
9285
{
93-
$node = factory(Node::class)->make();
86+
$node = factory(Node::class)->make(['id' => 123]);
9487

9588
$this->serverRepository->shouldReceive('setColumns')->with('id')->once()->andReturnSelf()
9689
->shouldReceive('findCountWhere')->with([['node_id', '=', $node->id]])->once()->andReturn(0);

tests/Unit/Services/Schedules/ProcessScheduleServiceTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function setUp(): void
4747
*/
4848
public function testScheduleIsUpdatedAndRun()
4949
{
50-
$model = factory(Schedule::class)->make();
50+
$model = factory(Schedule::class)->make(['id' => 123]);
5151
$model->setRelation('tasks', collect([$task = factory(Task::class)->make([
5252
'sequence_id' => 1,
5353
])]));
@@ -65,14 +65,12 @@ public function testScheduleIsUpdatedAndRun()
6565
$this->dispatcher->shouldReceive('dispatch')->with(m::on(function ($class) use ($model, $task) {
6666
$this->assertInstanceOf(RunTaskJob::class, $class);
6767
$this->assertSame($task->time_offset, $class->delay);
68-
$this->assertSame($task->id, $class->task);
69-
$this->assertSame($model->id, $class->schedule);
68+
$this->assertSame($task->id, $class->task->id);
7069

7170
return true;
7271
}))->once();
7372

7473
$this->getService()->handle($model);
75-
$this->assertTrue(true);
7674
}
7775

7876
/**

0 commit comments

Comments
 (0)