Build your NativePHP apps in the cloud. Plans from $19/month + a FREE Mobile Mini license

Power Monitor


On this page

#Fake Power Monitor

#Example test case

Copied!
use Native\Laravel\Facades\PowerMonitor;
 
#[\PHPUnit\Framework\Attributes\Test]
public function example(): void
{
PowerMonitor::fake();
 
$this->get('/whatever-action');
 
PowerMonitor::assertGetSystemIdleState('...');
}

#Available assertions

  • assertGetSystemIdleState
  • assertGetSystemIdleStateCount
  • assertGetSystemIdleTimeCount
  • assertGetCurrentThermalStateCount
  • assertIsOnBatteryPowerCount