-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Daniel Kesselberg <[email protected]>
- Loading branch information
Showing
9 changed files
with
188 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @author Frank Karlitschek <[email protected]> | ||
* | ||
* @license AGPL-3.0 | ||
* | ||
* This code is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License, version 3, | ||
* along with this program. If not, see <http://www.gnu.org/licenses/> | ||
* | ||
*/ | ||
|
||
namespace OCA\ServerInfo\OperatingSystems; | ||
|
||
use OCA\ServerInfo\Resources\Memory; | ||
|
||
class Dummy implements IOperatingSystem { | ||
public function supported(): bool { | ||
return false; | ||
} | ||
|
||
public function getMemory(): Memory { | ||
return new Memory(); | ||
} | ||
|
||
public function getCpuName(): string { | ||
return 'Unknown Processor'; | ||
} | ||
|
||
public function getTime(): string { | ||
return ''; | ||
} | ||
|
||
public function getUptime(): int { | ||
return -1; | ||
} | ||
|
||
public function getNetworkInfo(): array { | ||
return [ | ||
'hostname' => \gethostname(), | ||
'dns' => '', | ||
'gateway' => '', | ||
]; | ||
} | ||
|
||
public function getNetworkInterfaces(): array { | ||
return []; | ||
} | ||
|
||
public function getDiskInfo(): array { | ||
return []; | ||
} | ||
|
||
public function getThermalZones(): array { | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright (c) 2020 Daniel Kesselberg <[email protected]> | ||
* | ||
* @author Daniel Kesselberg <[email protected]> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
namespace OCA\ServerInfo\Tests; | ||
|
||
use OCA\ServerInfo\OperatingSystems\Dummy; | ||
use PHPUnit\Framework\MockObject\MockObject; | ||
use Test\TestCase; | ||
|
||
class DummyTest extends TestCase { | ||
/** @var Dummy|MockObject */ | ||
protected $os; | ||
|
||
protected function setUp(): void { | ||
parent::setUp(); // TODO: Change the autogenerated stub | ||
|
||
$this->os = new Dummy(); | ||
} | ||
|
||
public function testGetMemory(): void { | ||
$memory = $this->os->getMemory(); | ||
|
||
$this->assertEquals(-1, $memory->getMemTotal()); | ||
$this->assertEquals(-1, $memory->getMemFree()); | ||
$this->assertEquals(-1, $memory->getMemAvailable()); | ||
$this->assertEquals(-1, $memory->getSwapTotal()); | ||
$this->assertEquals(-1, $memory->getSwapFree()); | ||
} | ||
|
||
public function testGetCpuName(): void { | ||
$this->assertEquals('Unknown Processor', $this->os->getCpuName()); | ||
} | ||
|
||
public function testGetUptime(): void { | ||
$this->assertEquals(-1, $this->os->getUptime()); | ||
} | ||
|
||
|
||
public function testGetDiskInfo(): void { | ||
$this->assertEquals([], $this->os->getDiskInfo()); | ||
} | ||
|
||
public function testSupported(): void { | ||
$this->assertFalse($this->os->supported()); | ||
} | ||
|
||
public function testGetNetworkInterfaces(): void { | ||
$this->assertEquals([], $this->os->getNetworkInterfaces()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters