Initial commit of migrated code from noccylabs/acpi-thermal

This commit is contained in:
2015-01-23 19:15:07 +01:00
parent fa5788791a
commit 5b46f454c2
17 changed files with 946 additions and 0 deletions

5
tests/bootstrap.php Normal file
View 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
View 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());
}
}
}

View File

@ -0,0 +1 @@
enabled

View File

@ -0,0 +1 @@
step_wise

View File

@ -0,0 +1 @@
48000

View File

@ -0,0 +1 @@
acpitz

View File

@ -0,0 +1 @@
enabled

View File

@ -0,0 +1 @@
step_wise

View File

@ -0,0 +1 @@
64000

View File

@ -0,0 +1 @@
acpitz