php-linux-cpu/tests/src/CpuTest.php

39 lines
913 B
PHP

<?php
namespace NoccyLabs\Linux\Cpu;
class CpuTest extends \PhpUnit_Framework_TestCase
{
public function setup()
{
$this->cpu = new Cpu(__DIR__."/../static");
}
public function teardown()
{}
public function testGetCpuFrequencyInformation()
{
$current = $this->cpu->getCurrentFrequency();
$available = $this->cpu->getAvailableFrequencies();
$this->assertEquals($current, 2100000);
$this->assertContains($current, $available);
$this->assertEquals(3, count($available));
}
public function testGetCpuGovernorInformation()
{
$current = $this->cpu->getCurrentGovernor();
$available = $this->cpu->getAvailableGovernors();
$this->assertEquals($current, "ondemand");
$this->assertContains($current, $available);
$this->assertEquals(5, count($available));
}
}