diff --git a/apps/workflowengine/lib/Check/AbstractStringCheck.php b/apps/workflowengine/lib/Check/AbstractStringCheck.php index 77576266fc..0fd728e349 100644 --- a/apps/workflowengine/lib/Check/AbstractStringCheck.php +++ b/apps/workflowengine/lib/Check/AbstractStringCheck.php @@ -23,6 +23,7 @@ namespace OCA\WorkflowEngine\Check; use OCP\Files\Storage\IStorage; +use OCP\IL10N; use OCP\WorkflowEngine\ICheck; abstract class AbstractStringCheck implements ICheck { @@ -30,6 +31,16 @@ abstract class AbstractStringCheck implements ICheck { /** @var array[] Nested array: [Pattern => [ActualValue => Regex Result]] */ protected $matches; + /** @var IL10N */ + protected $l; + + /** + * @param IL10N $l + */ + public function __construct(IL10N $l) { + $this->l = $l; + } + /** * @param IStorage $storage * @param string $path @@ -81,12 +92,12 @@ abstract class AbstractStringCheck implements ICheck { */ public function validateCheck($operator, $value) { if (!in_array($operator, ['is', '!is', 'matches', '!matches'])) { - throw new \UnexpectedValueException('Invalid operator', 1); + throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); } if (in_array($operator, ['matches', '!matches']) && @preg_match($value, null) === false) { - throw new \UnexpectedValueException('Invalid regex', 2); + throw new \UnexpectedValueException($this->l->t('The given regular expression is invalid'), 2); } } diff --git a/apps/workflowengine/lib/Check/FileMimeType.php b/apps/workflowengine/lib/Check/FileMimeType.php index c774d30a23..1de9a70a17 100644 --- a/apps/workflowengine/lib/Check/FileMimeType.php +++ b/apps/workflowengine/lib/Check/FileMimeType.php @@ -23,6 +23,7 @@ namespace OCA\WorkflowEngine\Check; use OCP\Files\IMimeTypeDetector; +use OCP\IL10N; use OCP\IRequest; class FileMimeType extends AbstractStringCheck { @@ -37,10 +38,12 @@ class FileMimeType extends AbstractStringCheck { protected $mimeTypeDetector; /** + * @param IL10N $l * @param IRequest $request * @param IMimeTypeDetector $mimeTypeDetector */ - public function __construct(IRequest $request, IMimeTypeDetector $mimeTypeDetector) { + public function __construct(IL10N $l, IRequest $request, IMimeTypeDetector $mimeTypeDetector) { + parent::__construct($l); $this->request = $request; $this->mimeTypeDetector = $mimeTypeDetector; } diff --git a/apps/workflowengine/lib/Check/FileSize.php b/apps/workflowengine/lib/Check/FileSize.php index 70071757c1..1744793dec 100644 --- a/apps/workflowengine/lib/Check/FileSize.php +++ b/apps/workflowengine/lib/Check/FileSize.php @@ -23,6 +23,7 @@ namespace OCA\WorkflowEngine\Check; use OCP\Files\Storage\IStorage; +use OCP\IL10N; use OCP\IRequest; use OCP\Util; use OCP\WorkflowEngine\ICheck; @@ -32,13 +33,18 @@ class FileSize implements ICheck { /** @var int */ protected $size; + /** @var IL10N */ + protected $l; + /** @var IRequest */ protected $request; /** + * @param IL10N $l * @param IRequest $request */ - public function __construct(IRequest $request) { + public function __construct(IL10N $l, IRequest $request) { + $this->l = $l; $this->request = $request; } @@ -80,11 +86,11 @@ class FileSize implements ICheck { */ public function validateCheck($operator, $value) { if (!in_array($operator, ['less', '!less', 'greater', '!greater'])) { - throw new \UnexpectedValueException('Invalid operator', 1); + throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); } if (!preg_match('/^[0-9]+[ ]?[kmgt]?b$/i', $value)) { - throw new \UnexpectedValueException('Invalid file size', 2); + throw new \UnexpectedValueException($this->l->t('The given file size is invalid'), 2); } } diff --git a/apps/workflowengine/lib/Check/FileSystemTags.php b/apps/workflowengine/lib/Check/FileSystemTags.php index 77179631fc..e9b5a94596 100644 --- a/apps/workflowengine/lib/Check/FileSystemTags.php +++ b/apps/workflowengine/lib/Check/FileSystemTags.php @@ -24,6 +24,7 @@ namespace OCA\WorkflowEngine\Check; use OCP\Files\Cache\ICache; use OCP\Files\Storage\IStorage; +use OCP\IL10N; use OCP\SystemTag\ISystemTagManager; use OCP\SystemTag\ISystemTagObjectMapper; use OCP\SystemTag\TagNotFoundException; @@ -37,6 +38,9 @@ class FileSystemTags implements ICheck { /** @var array */ protected $fileSystemTags; + /** @var IL10N */ + protected $l; + /** @var ISystemTagManager */ protected $systemTagManager; @@ -50,10 +54,12 @@ class FileSystemTags implements ICheck { protected $path; /** + * @param IL10N $l * @param ISystemTagManager $systemTagManager * @param ISystemTagObjectMapper $systemTagObjectMapper */ - public function __construct(ISystemTagManager $systemTagManager, ISystemTagObjectMapper $systemTagObjectMapper) { + public function __construct(IL10N $l, ISystemTagManager $systemTagManager, ISystemTagObjectMapper $systemTagObjectMapper) { + $this->l = $l; $this->systemTagManager = $systemTagManager; $this->systemTagObjectMapper = $systemTagObjectMapper; } @@ -84,15 +90,15 @@ class FileSystemTags implements ICheck { */ public function validateCheck($operator, $value) { if (!in_array($operator, ['is', '!is'])) { - throw new \UnexpectedValueException('Invalid operator', 1); + throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); } try { $this->systemTagManager->getTagsByIds($value); } catch (TagNotFoundException $e) { - throw new \UnexpectedValueException('Tag does not exist', 2); + throw new \UnexpectedValueException($this->l->t('The given tag id is invalid'), 2); } catch (\InvalidArgumentException $e) { - throw new \UnexpectedValueException('Tag does not exist', 3); + throw new \UnexpectedValueException($this->l->t('The given tag id is invalid'), 3); } } diff --git a/apps/workflowengine/lib/Check/RequestRemoteAddress.php b/apps/workflowengine/lib/Check/RequestRemoteAddress.php index 7897fcbd9d..de9738fb63 100644 --- a/apps/workflowengine/lib/Check/RequestRemoteAddress.php +++ b/apps/workflowengine/lib/Check/RequestRemoteAddress.php @@ -23,18 +23,24 @@ namespace OCA\WorkflowEngine\Check; use OCP\Files\Storage\IStorage; +use OCP\IL10N; use OCP\IRequest; use OCP\WorkflowEngine\ICheck; class RequestRemoteAddress implements ICheck { + /** @var IL10N */ + protected $l; + /** @var IRequest */ protected $request; /** + * @param IL10N $l * @param IRequest $request */ - public function __construct(IRequest $request) { + public function __construct(IL10N $l, IRequest $request) { + $this->l = $l; $this->request = $request; } @@ -73,27 +79,27 @@ class RequestRemoteAddress implements ICheck { */ public function validateCheck($operator, $value) { if (!in_array($operator, ['matchesIPv4', '!matchesIPv4', 'matchesIPv6', '!matchesIPv6'])) { - throw new \UnexpectedValueException('Invalid operator', 1); + throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); } $decodedValue = explode('/', $value); if (sizeof($decodedValue) !== 2) { - throw new \UnexpectedValueException('Invalid IP range', 2); + throw new \UnexpectedValueException($this->l->t('The given IP range is invalid'), 2); } if (in_array($operator, ['matchesIPv4', '!matchesIPv4'])) { if (!filter_var($decodedValue[0], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { - throw new \UnexpectedValueException('Invalid IPv4 range', 3); + throw new \UnexpectedValueException($this->l->t('The given IP range is not valid for IPv4'), 3); } if ($decodedValue[1] > 32 || $decodedValue[1] <= 0) { - throw new \UnexpectedValueException('Invalid IPv4 range', 4); + throw new \UnexpectedValueException($this->l->t('The given IP range is not valid for IPv4'), 4); } } else { if (!filter_var($decodedValue[0], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { - throw new \UnexpectedValueException('Invalid IPv6 range', 3); + throw new \UnexpectedValueException($this->l->t('The given IP range is not valid for IPv6'), 3); } if ($decodedValue[1] > 128 || $decodedValue[1] <= 0) { - throw new \UnexpectedValueException('Invalid IPv6 range', 4); + throw new \UnexpectedValueException($this->l->t('The given IP range is not valid for IPv6'), 4); } } } diff --git a/apps/workflowengine/lib/Check/RequestTime.php b/apps/workflowengine/lib/Check/RequestTime.php index a114819d45..2aa79e7767 100644 --- a/apps/workflowengine/lib/Check/RequestTime.php +++ b/apps/workflowengine/lib/Check/RequestTime.php @@ -24,6 +24,7 @@ namespace OCA\WorkflowEngine\Check; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Files\Storage\IStorage; +use OCP\IL10N; use OCP\WorkflowEngine\ICheck; class RequestTime implements ICheck { @@ -34,13 +35,17 @@ class RequestTime implements ICheck { /** @var bool[] */ protected $cachedResults; + /** @var IL10N */ + protected $l; + /** @var ITimeFactory */ protected $timeFactory; /** * @param ITimeFactory $timeFactory */ - public function __construct(ITimeFactory $timeFactory) { + public function __construct(IL10N $l, ITimeFactory $timeFactory) { + $this->l = $l; $this->timeFactory = $timeFactory; } @@ -101,24 +106,24 @@ class RequestTime implements ICheck { */ public function validateCheck($operator, $value) { if (!in_array($operator, ['in', '!in'])) { - throw new \UnexpectedValueException('Invalid operator', 1); + throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); } $regexValue = '\"' . self::REGEX_TIME . ' ' . self::REGEX_TIMEZONE . '\"'; $result = preg_match('/^\[' . $regexValue . ',' . $regexValue . '\]$/', $value, $matches); if (!$result) { - throw new \UnexpectedValueException('Invalid time limits', 2); + throw new \UnexpectedValueException($this->l->t('The given time span is invalid'), 2); } $values = json_decode($value, true); $time1 = \DateTime::createFromFormat('H:i e', $values[0]); if ($time1 === false) { - throw new \UnexpectedValueException('Invalid start time given', 3); + throw new \UnexpectedValueException($this->l->t('The given start time is invalid'), 3); } $time2 = \DateTime::createFromFormat('H:i e', $values[1]); if ($time2 === false) { - throw new \UnexpectedValueException('Invalid end time given', 3); + throw new \UnexpectedValueException($this->l->t('The given end time is invalid'), 4); } } } diff --git a/apps/workflowengine/lib/Check/RequestURL.php b/apps/workflowengine/lib/Check/RequestURL.php index 0cae3cf7e5..36d41c101f 100644 --- a/apps/workflowengine/lib/Check/RequestURL.php +++ b/apps/workflowengine/lib/Check/RequestURL.php @@ -22,6 +22,7 @@ namespace OCA\WorkflowEngine\Check; +use OCP\IL10N; use OCP\IRequest; class RequestURL extends AbstractStringCheck { @@ -33,9 +34,11 @@ class RequestURL extends AbstractStringCheck { protected $request; /** + * @param IL10N $l * @param IRequest $request */ - public function __construct(IRequest $request) { + public function __construct(IL10N $l, IRequest $request) { + parent::__construct($l); $this->request = $request; } diff --git a/apps/workflowengine/lib/Check/RequestUserAgent.php b/apps/workflowengine/lib/Check/RequestUserAgent.php index 241b19136a..7a8d4a71ac 100644 --- a/apps/workflowengine/lib/Check/RequestUserAgent.php +++ b/apps/workflowengine/lib/Check/RequestUserAgent.php @@ -22,6 +22,7 @@ namespace OCA\WorkflowEngine\Check; +use OCP\IL10N; use OCP\IRequest; class RequestUserAgent extends AbstractStringCheck { @@ -30,9 +31,11 @@ class RequestUserAgent extends AbstractStringCheck { protected $request; /** + * @param IL10N $l * @param IRequest $request */ - public function __construct(IRequest $request) { + public function __construct(IL10N $l, IRequest $request) { + parent::__construct($l); $this->request = $request; } diff --git a/apps/workflowengine/lib/Check/UserGroupMembership.php b/apps/workflowengine/lib/Check/UserGroupMembership.php index 6390c57fbe..fd6ba00d09 100644 --- a/apps/workflowengine/lib/Check/UserGroupMembership.php +++ b/apps/workflowengine/lib/Check/UserGroupMembership.php @@ -89,11 +89,11 @@ class UserGroupMembership implements ICheck { */ public function validateCheck($operator, $value) { if (!in_array($operator, ['is', '!is'])) { - throw new \UnexpectedValueException($this->l->t('Operator %s is invalid', $operator), 1); + throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); } if (!$this->groupManager->groupExists($value)) { - throw new \UnexpectedValueException($this->l->t('Group %s does not exist', $value), 2); + throw new \UnexpectedValueException($this->l->t('The given group does not exist'), 2); } } diff --git a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php index 43818ab8e2..91da893160 100644 --- a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php +++ b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php @@ -24,6 +24,30 @@ namespace OCA\WorkflowEngine\Tests\Check; class AbstractStringCheckTest extends \Test\TestCase { + protected function getCheckMock() { + $l = $this->getMockBuilder('OCP\IL10N') + ->disableOriginalConstructor() + ->getMock(); + $l->expects($this->any()) + ->method('t') + ->willReturnCallback(function($string, $args) { + return sprintf($string, $args); + }); + + $check = $this->getMockBuilder('OCA\WorkflowEngine\Check\AbstractStringCheck') + ->setConstructorArgs([ + $l, + ]) + ->setMethods([ + 'setPath', + 'executeCheck', + 'getActualValue', + ]) + ->getMock(); + + return $check; + } + public function dataExecuteStringCheck() { return [ ['is', 'same', 'same', true], @@ -46,13 +70,7 @@ class AbstractStringCheckTest extends \Test\TestCase { * @param bool $expected */ public function testExecuteStringCheck($operation, $checkValue, $actualValue, $expected) { - $check = $this->getMockBuilder('OCA\WorkflowEngine\Check\AbstractStringCheck') - ->setMethods([ - 'setPath', - 'executeCheck', - 'getActualValue', - ]) - ->getMock(); + $check = $this->getCheckMock(); /** @var \OCA\WorkflowEngine\Check\AbstractStringCheck $check */ $this->assertEquals($expected, $this->invokePrivate($check, 'executeStringCheck', [$operation, $checkValue, $actualValue])); @@ -73,13 +91,7 @@ class AbstractStringCheckTest extends \Test\TestCase { * @param string $value */ public function testValidateCheck($operator, $value) { - $check = $this->getMockBuilder('OCA\WorkflowEngine\Check\AbstractStringCheck') - ->setMethods([ - 'setPath', - 'executeCheck', - 'getActualValue', - ]) - ->getMock(); + $check = $this->getCheckMock(); /** @var \OCA\WorkflowEngine\Check\AbstractStringCheck $check */ $check->validateCheck($operator, $value); @@ -87,10 +99,10 @@ class AbstractStringCheckTest extends \Test\TestCase { public function dataValidateCheckInvalid() { return [ - ['!!is', '', 1, 'Invalid operator'], - ['less', '', 1, 'Invalid operator'], - ['matches', '/Invalid(Regex/', 2, 'Invalid regex'], - ['!matches', '/Invalid(Regex/', 2, 'Invalid regex'], + ['!!is', '', 1, 'The given operator is invalid'], + ['less', '', 1, 'The given operator is invalid'], + ['matches', '/Invalid(Regex/', 2, 'The given regular expression is invalid'], + ['!matches', '/Invalid(Regex/', 2, 'The given regular expression is invalid'], ]; } @@ -102,13 +114,7 @@ class AbstractStringCheckTest extends \Test\TestCase { * @param $exceptionMessage */ public function testValidateCheckInvalid($operator, $value, $exceptionCode, $exceptionMessage) { - $check = $this->getMockBuilder('OCA\WorkflowEngine\Check\AbstractStringCheck') - ->setMethods([ - 'setPath', - 'executeCheck', - 'getActualValue', - ]) - ->getMock(); + $check = $this->getCheckMock(); try { /** @var \OCA\WorkflowEngine\Check\AbstractStringCheck $check */ @@ -134,13 +140,7 @@ class AbstractStringCheckTest extends \Test\TestCase { * @param bool $expected */ public function testMatch($pattern, $subject, $matches, $expected) { - $check = $this->getMockBuilder('OCA\WorkflowEngine\Check\AbstractStringCheck') - ->setMethods([ - 'setPath', - 'executeCheck', - 'getActualValue', - ]) - ->getMock(); + $check = $this->getCheckMock(); $this->invokePrivate($check, 'matches', [$matches]); diff --git a/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php b/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php index ec8798794d..efe8f6372d 100644 --- a/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php +++ b/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php @@ -27,6 +27,21 @@ class RequestRemoteAddressTest extends \Test\TestCase { /** @var \OCP\IRequest|\PHPUnit_Framework_MockObject_MockObject */ protected $request; + /** + * @return \OCP\IL10N|\PHPUnit_Framework_MockObject_MockObject + */ + protected function getL10NMock() { + $l = $this->getMockBuilder('OCP\IL10N') + ->disableOriginalConstructor() + ->getMock(); + $l->expects($this->any()) + ->method('t') + ->willReturnCallback(function ($string, $args) { + return sprintf($string, $args); + }); + return $l; + } + protected function setUp() { parent::setUp(); @@ -52,7 +67,7 @@ class RequestRemoteAddressTest extends \Test\TestCase { * @param bool $expected */ public function testExecuteCheckMatchesIPv4($value, $ip, $expected) { - $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->request); + $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request); $this->request->expects($this->once()) ->method('getRemoteAddress') @@ -68,7 +83,7 @@ class RequestRemoteAddressTest extends \Test\TestCase { * @param bool $expected */ public function testExecuteCheckNotMatchesIPv4($value, $ip, $expected) { - $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->request); + $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request); $this->request->expects($this->once()) ->method('getRemoteAddress') @@ -96,7 +111,7 @@ class RequestRemoteAddressTest extends \Test\TestCase { * @param bool $expected */ public function testExecuteCheckMatchesIPv6($value, $ip, $expected) { - $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->request); + $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request); $this->request->expects($this->once()) ->method('getRemoteAddress') @@ -112,7 +127,7 @@ class RequestRemoteAddressTest extends \Test\TestCase { * @param bool $expected */ public function testExecuteCheckNotMatchesIPv6($value, $ip, $expected) { - $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->request); + $check = new \OCA\WorkflowEngine\Check\RequestRemoteAddress($this->getL10NMock(), $this->request); $this->request->expects($this->once()) ->method('getRemoteAddress') diff --git a/apps/workflowengine/tests/Check/RequestTimeTest.php b/apps/workflowengine/tests/Check/RequestTimeTest.php index ca279cca0c..c07b4bf877 100644 --- a/apps/workflowengine/tests/Check/RequestTimeTest.php +++ b/apps/workflowengine/tests/Check/RequestTimeTest.php @@ -27,6 +27,21 @@ class RequestTimeTest extends \Test\TestCase { /** @var \OCP\AppFramework\Utility\ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $timeFactory; + /** + * @return \OCP\IL10N|\PHPUnit_Framework_MockObject_MockObject + */ + protected function getL10NMock() { + $l = $this->getMockBuilder('OCP\IL10N') + ->disableOriginalConstructor() + ->getMock(); + $l->expects($this->any()) + ->method('t') + ->willReturnCallback(function ($string, $args) { + return sprintf($string, $args); + }); + return $l; + } + protected function setUp() { parent::setUp(); @@ -72,7 +87,7 @@ class RequestTimeTest extends \Test\TestCase { * @param bool $expected */ public function testExecuteCheckIn($value, $timestamp, $expected) { - $check = new \OCA\WorkflowEngine\Check\RequestTime($this->timeFactory); + $check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory); $this->timeFactory->expects($this->once()) ->method('getTime') @@ -88,7 +103,7 @@ class RequestTimeTest extends \Test\TestCase { * @param bool $expected */ public function testExecuteCheckNotIn($value, $timestamp, $expected) { - $check = new \OCA\WorkflowEngine\Check\RequestTime($this->timeFactory); + $check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory); $this->timeFactory->expects($this->once()) ->method('getTime') @@ -99,9 +114,9 @@ class RequestTimeTest extends \Test\TestCase { public function dataValidateCheck() { return [ - ['in', json_encode(['08:00 Europe/Berlin', '17:00 Europe/Berlin'])], - ['!in', json_encode(['08:00 Europe/Berlin', '17:00 America/North_Dakota/Beulah'])], - ['in', json_encode(['08:00 America/Port-au-Prince', '17:00 America/Argentina/San_Luis'])], + ['in', '["08:00 Europe/Berlin","17:00 Europe/Berlin"]'], + ['!in', '["08:00 Europe/Berlin","17:00 America/North_Dakota/Beulah"]'], + ['in', '["08:00 America/Port-au-Prince","17:00 America/Argentina/San_Luis"]'], ]; } @@ -111,18 +126,19 @@ class RequestTimeTest extends \Test\TestCase { * @param string $value */ public function testValidateCheck($operator, $value) { - $check = new \OCA\WorkflowEngine\Check\RequestTime($this->timeFactory); + $check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory); $check->validateCheck($operator, $value); } public function dataValidateCheckInvalid() { return [ - ['!!in', json_encode(['08:00 Europe/Berlin', '17:00 Europe/Berlin']), 1, 'Invalid operator'], - ['in', json_encode(['28:00 Europe/Berlin', '17:00 Europe/Berlin']), 2, 'Invalid time limits'], - ['in', json_encode(['08:00 Europa/Berlin', '17:00 Europe/Berlin']), 3, 'Invalid timezone1'], - ['in', json_encode(['08:00 Europe/Berlin', '17:00 Europa/Berlin']), 3, 'Invalid timezone2'], - ['in', json_encode(['08:00 Europe/Bearlin', '17:00 Europe/Berlin']), 3, 'Invalid timezone1'], - ['in', json_encode(['08:00 Europe/Berlin', '17:00 Europe/Bearlin']), 3, 'Invalid timezone2'], + ['!!in', '["08:00 Europe/Berlin","17:00 Europe/Berlin"]', 1, 'The given operator is invalid'], + ['in', '["28:00 Europe/Berlin","17:00 Europe/Berlin"]', 2, 'The given time span is invalid'], + ['in', '["08:00 Europe/Berlin","27:00 Europe/Berlin"]', 2, 'The given time span is invalid'], + ['in', '["08:00 Europa/Berlin","17:00 Europe/Berlin"]', 3, 'The given start time is invalid'], + ['in', '["08:00 Europe/Berlin","17:00 Europa/Berlin"]', 4, 'The given end time is invalid'], + ['in', '["08:00 Europe/Bearlin","17:00 Europe/Berlin"]', 3, 'The given start time is invalid'], + ['in', '["08:00 Europe/Berlin","17:00 Europe/Bearlin"]', 4, 'The given end time is invalid'], ]; } @@ -134,7 +150,7 @@ class RequestTimeTest extends \Test\TestCase { * @param string $exceptionMessage */ public function testValidateCheckInvalid($operator, $value, $exceptionCode, $exceptionMessage) { - $check = new \OCA\WorkflowEngine\Check\RequestTime($this->timeFactory); + $check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory); try { $check->validateCheck($operator, $value);