From 5ba62044a246a892837c4f889cc675b68ee1738a Mon Sep 17 00:00:00 2001 From: Pavel Dyakonov Date: Thu, 20 Dec 2018 18:18:02 +0300 Subject: [PATCH] upd tests --- .travis.yml | 1 + tests/GinfoTest.php | 73 +++++++++++++++++++++++++++++++-------------- 2 files changed, 52 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index e748aacb..a2203805 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ language: php php: - 7.1 - 7.2 + - 7.3 - nightly matrix: diff --git a/tests/GinfoTest.php b/tests/GinfoTest.php index 377a4765..2c3a73cb 100644 --- a/tests/GinfoTest.php +++ b/tests/GinfoTest.php @@ -40,9 +40,12 @@ public function testGeneral() public function testCpu() { $cpu = $this->info->getCpu(); - $this->assertInstanceOf(Info\Cpu::class, $cpu); - - \print_r($cpu); + if (null === $cpu) { + $this->markTestSkipped('Can\'t get cpu'); + } else { + $this->assertInstanceOf(Info\Cpu::class, $cpu); + \print_r($cpu); + } } public function testMemory() @@ -59,33 +62,45 @@ public function testMemory() public function testProcesses() { $processes = $this->info->getProcesses(); - $this->assertInternalType('array', $processes); - - \print_r($processes); + if (null === $processes) { + $this->markTestSkipped('Can\'t get processes'); + } else { + $this->assertInternalType('array', $processes); + \print_r($processes); + } } public function testNetwork() { $network = $this->info->getNetwork(); - $this->assertInternalType('array', $network); - - \print_r($network); + if (null === $network) { + $this->markTestSkipped('Can\'t get network'); + } else { + $this->assertInternalType('array', $network); + \print_r($network); + } } public function testUsb() { $usb = $this->info->getUsb(); - $this->assertInternalType('array', $usb); - - \print_r($usb); + if (null === $usb) { + $this->markTestSkipped('Can\'t get usb'); + } else { + $this->assertInternalType('array', $usb); + \print_r($usb); + } } public function testPci() { $pci = $this->info->getPci(); - $this->assertInternalType('array', $pci); - - \print_r($pci); + if (null === $pci) { + $this->markTestSkipped('Can\'t get pci'); + } else { + $this->assertInternalType('array', $pci); + \print_r($pci); + } } public function testSoundCard() @@ -206,16 +221,30 @@ public function testPrinters() public function testDisk() { $disk = $this->info->getDisk(); - $this->assertInternalType('array', $disk->getDrives()); - $this->assertInternalType('array', $disk->getMounts()); - if (\DIRECTORY_SEPARATOR === '\\') { - $this->assertNull($disk->getRaids()); //todo - //$this->markTestSkipped('Not implemented for windows'); + $drivers = $disk->getDrives(); + $mounts = $disk->getMounts(); + $raids = $disk->getRaids(); + + if (null === $drivers) { + $this->markTestSkipped('Can\'t get drivers'); } else { - $this->assertInternalType('array', $disk->getRaids()); + $this->assertInternalType('array', $drivers); + \print_r($drivers); } - \print_r($disk); + if (null === $mounts) { + $this->markTestSkipped('Can\'t get mounts'); + } else { + $this->assertInternalType('array', $mounts); + \print_r($mounts); + } + + if (null === $raids) { + $this->markTestSkipped('Can\'t get raids'); + } else { + $this->assertInternalType('array', $raids); + \print_r($raids); + } } }