function it_is_initializable() { if (Unix::isUnix()) { //Currently this will work only on *nix $this->shouldHaveType('Hexmedia\\Crontab\\Writer\\SystemWriter'); } }
function it_is_able_to_create_writer(Crontab $crontab) { $this->isSystemSupported(); $created = $this::create($crontab); $created->shouldImplement('Hexmedia\\Crontab\\Writer\\System\\WriterInterface'); if (true === Unix::isUnix()) { $created->shouldImplement('Hexmedia\\Crontab\\Writer\\System\\UnixWriter'); } }
function it_is_throwing_when_there_is_no_parser() { $wasUnix = false; if (true === Unix::isUnix()) { $wasUnix = true; Unix::removeUnix(PHP_OS); } $this->clearParser()->shouldReturn($this); $this->getParsers()->shouldHaveCount(0); $this->shouldThrow(new NoSupportedParserException(sprintf('There is no supported parser for this type or operating system (your is "%s").', PHP_OS)))->duringCreate('some text', '/tmp/file'); if ($wasUnix) { Unix::addUnix(PHP_OS); } }
/** * @return bool * * @SuppressWarnings(PHPMD.StaticAccess) */ public static function isSupported() { return Unix::isUnix(); }
protected function isSystemSupported() { if (false === Unix::isUnix()) { throw new SkippingException(sprintf('Your os "%s" is currently not supported.', PHP_OS)); } }