Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function isSupported()
 {
     if (OsHelper::isMacOS() && version_compare(OsHelper::getMacOSVersion(), '10.9.0', '>=')) {
         return parent::isSupported();
     }
     return false;
 }
 /**
  * {@inheritdoc}
  */
 protected function getExpectedCommandLineForNotificationWithAllOptions()
 {
     if (OsHelper::isMacOS() && version_compare(OsHelper::getMacOSVersion(), '10.9.0', '>=')) {
         return "'terminal-notifier' '-message' 'I'\\''m the notification body' '-title' 'I'\\''m the notification title' '-appIcon' '/home/toto/Images/my-icon.png'";
     }
     return "'terminal-notifier' '-message' 'I'\\''m the notification body' '-title' 'I'\\''m the notification title'";
 }
 public function testIsSupported()
 {
     $notifier = $this->getNotifier();
     if (OsHelper::isMacOS() && version_compare(OsHelper::getMacOSVersion(), '10.9.0', '>=')) {
         $this->assertTrue($notifier->isSupported());
     } else {
         $this->assertFalse($notifier->isSupported());
     }
 }
Пример #4
0
 public function testGetMacOSVersion()
 {
     if (!OsHelper::isMacOS()) {
         $this->markTestSkipped('Can only be run on MacOS');
     }
     $expectedMacOsVersion = exec('sw_vers -productVersion', $output);
     $macOsVersion = OsHelper::getMacOSVersion();
     $this->assertRegExp('#\\d{1,2}\\.\\d{1,2}(\\.\\d{1,2})?#', $macOsVersion);
     $this->assertSame($expectedMacOsVersion, $macOsVersion);
 }
 /**
  * {@inheritdoc}
  */
 protected function configureProcess(ProcessBuilder $processBuilder, Notification $notification)
 {
     $processBuilder->add('-message');
     $processBuilder->add($notification->getBody());
     if ($notification->getTitle()) {
         $processBuilder->add('-title');
         $processBuilder->add($notification->getTitle());
     }
     if ($notification->getIcon() && version_compare(OsHelper::getMacOSVersion(), '10.9.0', '>=')) {
         $processBuilder->add('-appIcon');
         $processBuilder->add($notification->getIcon());
     }
 }