newInstanceWithoutConstructor(); $runVar = [ 'counts' => [ 'now' => [ 'processnfo' => 2, 'tv' => 1, ], 'start' => [], 'diff' => [], 'percent' => [], ], ]; $runVarProperty = new ReflectionProperty(TmuxMonitorService::class, 'runVar'); $runVarProperty->setValue($monitor, $runVar); $iterationsProperty = new ReflectionProperty(TmuxMonitorService::class, 'iterations'); $iterationsProperty->setValue($monitor, 1); $calculate = new ReflectionMethod(TmuxMonitorService::class, 'calculateStatistics'); $calculate->invoke($monitor); $updatedRunVar = $runVarProperty->getValue($monitor); $this->assertSame(0, $updatedRunVar['counts']['now']['work']); $this->assertSame(0, $updatedRunVar['counts']['now']['work_available']); $this->assertSame('0', $updatedRunVar['counts']['diff']['work']); $this->assertSame('0', $updatedRunVar['counts']['diff']['work_available']); $this->assertSame(2, $updatedRunVar['counts']['now']['total_work']); } }