From b9eb87deaa0be2293fe8977e0592fe5f34b0e769 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Mon, 5 Oct 2020 21:31:39 -0700 Subject: [PATCH] Fix node and schedule unit tests --- tests/Unit/Services/Nodes/NodeDeletionServiceTest.php | 9 +-------- .../Services/Schedules/ProcessScheduleServiceTest.php | 6 ++---- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/tests/Unit/Services/Nodes/NodeDeletionServiceTest.php b/tests/Unit/Services/Nodes/NodeDeletionServiceTest.php index 88ebaaaf..dbab1549 100644 --- a/tests/Unit/Services/Nodes/NodeDeletionServiceTest.php +++ b/tests/Unit/Services/Nodes/NodeDeletionServiceTest.php @@ -1,11 +1,4 @@ . - * - * 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); diff --git a/tests/Unit/Services/Schedules/ProcessScheduleServiceTest.php b/tests/Unit/Services/Schedules/ProcessScheduleServiceTest.php index e0b9d9d1..01bbac14 100644 --- a/tests/Unit/Services/Schedules/ProcessScheduleServiceTest.php +++ b/tests/Unit/Services/Schedules/ProcessScheduleServiceTest.php @@ -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); } /**