forked from Alex/Pterodactyl-Panel
Fix node and schedule unit tests
This commit is contained in:
parent
0c2bd416ee
commit
b9eb87deaa
@ -1,11 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Tests\Unit\Services\Nodes;
|
||||
|
||||
@ -90,7 +83,7 @@ class NodeDeletionServiceTest extends TestCase
|
||||
*/
|
||||
public function testModelCanBePassedToFunctionInPlaceOfNodeId()
|
||||
{
|
||||
$node = factory(Node::class)->make();
|
||||
$node = factory(Node::class)->make(['id' => 123]);
|
||||
|
||||
$this->serverRepository->shouldReceive('setColumns')->with('id')->once()->andReturnSelf()
|
||||
->shouldReceive('findCountWhere')->with([['node_id', '=', $node->id]])->once()->andReturn(0);
|
||||
|
@ -47,7 +47,7 @@ class ProcessScheduleServiceTest extends TestCase
|
||||
*/
|
||||
public function testScheduleIsUpdatedAndRun()
|
||||
{
|
||||
$model = factory(Schedule::class)->make();
|
||||
$model = factory(Schedule::class)->make(['id' => 123]);
|
||||
$model->setRelation('tasks', collect([$task = factory(Task::class)->make([
|
||||
'sequence_id' => 1,
|
||||
])]));
|
||||
@ -65,14 +65,12 @@ class ProcessScheduleServiceTest extends TestCase
|
||||
$this->dispatcher->shouldReceive('dispatch')->with(m::on(function ($class) use ($model, $task) {
|
||||
$this->assertInstanceOf(RunTaskJob::class, $class);
|
||||
$this->assertSame($task->time_offset, $class->delay);
|
||||
$this->assertSame($task->id, $class->task);
|
||||
$this->assertSame($model->id, $class->schedule);
|
||||
$this->assertSame($task->id, $class->task->id);
|
||||
|
||||
return true;
|
||||
}))->once();
|
||||
|
||||
$this->getService()->handle($model);
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user