diff options
-rw-r--r-- | lib/OperatingSystems/DefaultOs.php | 2 | ||||
-rw-r--r-- | tests/data/df_tp | 1 | ||||
-rw-r--r-- | tests/lib/DefaultOsTest.php | 10 |
3 files changed, 11 insertions, 2 deletions
diff --git a/lib/OperatingSystems/DefaultOs.php b/lib/OperatingSystems/DefaultOs.php index 0465357..bc91cc5 100644 --- a/lib/OperatingSystems/DefaultOs.php +++ b/lib/OperatingSystems/DefaultOs.php @@ -188,7 +188,7 @@ class DefaultOs implements IOperatingSystem { } $matches = []; - $pattern = '/^(?<Filesystem>[\S]+)\s*(?<Type>\w+)\s*(?<Blocks>\d+)\s*(?<Used>\d+)\s*(?<Available>\d+)\s*(?<Capacity>\d+%)\s*(?<Mounted>[\w\/-]+)$/m'; + $pattern = '/^(?<Filesystem>[\S]+)\s*(?<Type>[\S]+)\s*(?<Blocks>\d+)\s*(?<Used>\d+)\s*(?<Available>\d+)\s*(?<Capacity>\d+%)\s*(?<Mounted>[\w\/-]+)$/m'; $result = preg_match_all($pattern, $disks, $matches); if ($result === 0 || $result === false) { diff --git a/tests/data/df_tp b/tests/data/df_tp index 4d9cbb3..c330e56 100644 --- a/tests/data/df_tp +++ b/tests/data/df_tp @@ -10,3 +10,4 @@ vagrant vboxsf 958123168 614831132 343292036 home_vagrant_code vboxsf 958123168 614831132 343292036 65% /home/vagrant/code tmpfs tmpfs 816800 0 816800 0% /run/user/1000 nfs.example.com:/export nfs4 14820 0 1230 0% /nfs +198.51.100.42:/storage fuse.sshfs 47929956 53116 45419052 1% /mnt/sshfs diff --git a/tests/lib/DefaultOsTest.php b/tests/lib/DefaultOsTest.php index 1fb58d3..ff83e92 100644 --- a/tests/lib/DefaultOsTest.php +++ b/tests/lib/DefaultOsTest.php @@ -174,7 +174,15 @@ class DefaultOsTest extends TestCase { $disk5->setPercent('0%'); $disk5->setMount('/nfs'); - $this->assertEquals([$disk1, $disk2, $disk3, $disk4, $disk5], $this->os->getDiskInfo()); + $disk6 = new Disk(); + $disk6->setDevice('198.51.100.42:/storage'); + $disk6->setFs('fuse.sshfs'); + $disk6->setUsed(51); + $disk6->setAvailable(44354); + $disk6->setPercent('1%'); + $disk6->setMount('/mnt/sshfs'); + + $this->assertEquals([$disk1, $disk2, $disk3, $disk4, $disk5, $disk6], $this->os->getDiskInfo()); } public function testGetDiskInfoNoCommandOutput(): void { |