Initial commit of migrated code from noccylabs/acpi-thermal
This commit is contained in:
5
tests/bootstrap.php
Normal file
5
tests/bootstrap.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
extension_loaded("xdebug") || (is_callable("dl") && @dl("xdebug.so"));
|
||||
|
||||
require_once __DIR__."/../vendor/autoload.php";
|
51
tests/src/ZoneTest.php
Normal file
51
tests/src/ZoneTest.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace NoccyLabs\Linux\Thermal;
|
||||
|
||||
class ZoneTest extends \PhpUnit_Framework_TestCase
|
||||
{
|
||||
public function setup()
|
||||
{
|
||||
Zone::setSysfsRoot( __DIR__."/../static" );
|
||||
}
|
||||
|
||||
public function testEnumeratingZones()
|
||||
{
|
||||
$zones = Zone::getAllZones();
|
||||
$this->assertEquals(2, count($zones));
|
||||
$this->assertArrayHasKey("thermal_zone0", $zones);
|
||||
$this->assertArrayHasKey("thermal_zone1", $zones);
|
||||
$this->assertInstanceOf('NoccyLabs\Linux\Thermal\Zone', $zones["thermal_zone0"]);
|
||||
$this->assertInstanceOf('NoccyLabs\Linux\Thermal\Zone', $zones["thermal_zone1"]);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @expectedException InvalidArgumentException
|
||||
*/
|
||||
public function testCreatingInvalidZone()
|
||||
{
|
||||
$zone2 = new Zone("thermal_zone2");
|
||||
}
|
||||
|
||||
public function testReadingZoneTemperatures()
|
||||
{
|
||||
$zone0 = new Zone("thermal_zone0");
|
||||
$this->assertEquals("thermal_zone0", $zone0->getName());
|
||||
$this->assertEquals(48.0, $zone0->getTemp());
|
||||
$zone1 = new Zone("thermal_zone1");
|
||||
$this->assertEquals("thermal_zone1", $zone1->getName());
|
||||
$this->assertEquals(64.0, $zone1->getTemp());
|
||||
}
|
||||
|
||||
public function testReadingZoneInformation()
|
||||
{
|
||||
$zones = Zone::getAllZones();
|
||||
foreach($zones as $zone) {
|
||||
$this->assertEquals("acpitz", $zone->getType());
|
||||
$this->assertEquals("enabled", $zone->getMode());
|
||||
$this->assertEquals("step_wise", $zone->getPolicy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1
tests/static/thermal_zone0/mode
Normal file
1
tests/static/thermal_zone0/mode
Normal file
@ -0,0 +1 @@
|
||||
enabled
|
1
tests/static/thermal_zone0/policy
Normal file
1
tests/static/thermal_zone0/policy
Normal file
@ -0,0 +1 @@
|
||||
step_wise
|
1
tests/static/thermal_zone0/temp
Normal file
1
tests/static/thermal_zone0/temp
Normal file
@ -0,0 +1 @@
|
||||
48000
|
1
tests/static/thermal_zone0/type
Normal file
1
tests/static/thermal_zone0/type
Normal file
@ -0,0 +1 @@
|
||||
acpitz
|
1
tests/static/thermal_zone1/mode
Normal file
1
tests/static/thermal_zone1/mode
Normal file
@ -0,0 +1 @@
|
||||
enabled
|
1
tests/static/thermal_zone1/policy
Normal file
1
tests/static/thermal_zone1/policy
Normal file
@ -0,0 +1 @@
|
||||
step_wise
|
1
tests/static/thermal_zone1/temp
Normal file
1
tests/static/thermal_zone1/temp
Normal file
@ -0,0 +1 @@
|
||||
64000
|
1
tests/static/thermal_zone1/type
Normal file
1
tests/static/thermal_zone1/type
Normal file
@ -0,0 +1 @@
|
||||
acpitz
|
Reference in New Issue
Block a user