/** * @test */ public function isProgramInstalled() { if (!OperatingSystem::isWindows()) { $this->markTestSkipped('Only tested on windows'); } $this->assertTrue(WindowsSystem::isProgramInstalled("notepad")); $this->assertFalse(WindowsSystem::isProgramInstalled("notepad-that-never-made-it-into-windows-kernel")); $this->assertFalse(WindowsSystem::isProgramInstalled("invalid\\command*name|thisis")); }
/** * @param string $program * @return bool */ public static function isProgramInstalled($program) { if (self::isWindows()) { return WindowsSystem::isProgramInstalled($program); } $out = null; $return = null; @exec('which ' . $program, $out, $return); return $return === 0; }
/** * @test */ public function isProgramInstalled() { $this->assertTrue(WindowsSystem::isProgramInstalled("notepad")); $this->assertFalse(WindowsSystem::isProgramInstalled("notepad-that-never-made-it-into-windows-kernel")); $this->assertFalse(WindowsSystem::isProgramInstalled("invalid\\command*name|thisis")); }