@@ -43,11 +43,44 @@ private function buildSystemCtlMock($output)
4343 return $ systemctl ;
4444 }
4545
46- public function testListUnits ()
46+ public function testListUnitsWithAvailableUnits ()
4747 {
48- $ systemctl = new SystemCtl ();
48+ $ output = <<<EOT
49+ proc-sys-fs-binfmt_misc.timer loaded active mounted Arbitrary Executable File Formats File System
50+ run-rpc_pipefs.mount loaded active mounted /run/rpc_pipefs
51+ sys-fs-fuse-connections.mount loaded active mounted FUSE Control File System
52+ sys-kernel-debug.mount loaded active mounted Debug File System
53+ acpid.path loaded active running ACPI Events Check
54+ systemd-ask-password-console.path loaded active waiting Dispatch Password Requests to Console Directory Wa
55+ systemd-ask-password-wall.path loaded active waiting Forward Password Requests to Wall Directory Watch
56+ acpid.service loaded active running ACPI event daemon
57+ beanstalkd.service loaded active running Simple, fast work queue
58+ console-setup.service loaded active exited LSB: Set console font and keymap
59+ cron.service loaded active running Regular background program processing daemon
60+ EOT ;
61+ $ systemctl = $ this ->buildSystemCtlMock ($ output );
62+ $ units = $ systemctl ->listUnits (SystemCtl::AVAILABLE_UNITS );
63+ $ this ->assertCount (11 , $ units );
64+ }
65+
66+ public function testListUnitsWithSupportedUnits ()
67+ {
68+ $ output = <<<EOT
69+ proc-sys-fs-binfmt_misc.timer loaded active mounted Arbitrary Executable File Formats File System
70+ run-rpc_pipefs.mount loaded active mounted /run/rpc_pipefs
71+ sys-fs-fuse-connections.mount loaded active mounted FUSE Control File System
72+ sys-kernel-debug.mount loaded active mounted Debug File System
73+ acpid.path loaded active running ACPI Events Check
74+ systemd-ask-password-console.path loaded active waiting Dispatch Password Requests to Console Directory Wa
75+ systemd-ask-password-wall.path loaded active waiting Forward Password Requests to Wall Directory Watch
76+ acpid.service loaded active running ACPI event daemon
77+ beanstalkd.service loaded active running Simple, fast work queue
78+ console-setup.service loaded active exited LSB: Set console font and keymap
79+ cron.service loaded active running Regular background program processing daemon
80+ EOT ;
81+ $ systemctl = $ this ->buildSystemCtlMock ($ output );
4982 $ units = $ systemctl ->listUnits ();
50- $ this ->assertTrue ( count ( $ units) > 0 );
83+ $ this ->assertCount ( 5 , $ units );
5184 }
5285
5386 public function testCreateUnitFromSupportedSuffixShouldWord ()
0 commit comments