/** * Tests the name of the rule */ public function testName() { $dir = new Exists(); $this->assertEquals($dir->getName(), 'rcf_container_exists'); }
/** * The error template * * @var string */ protected $error_message = 'Your container doesn\'t appear to exist...'; /** * (non-PHPdoc) * * @ignore * * @see \mithra62\Validate\RuleInterface::validate() */ public function validate($field, $input, array $params = array()) { try { if ($input == '' || empty($params['0'])) { return false; } $params = $params['0']; if (empty($params['rcf_username']) || empty($params['rcf_api']) || empty($params['rcf_container'])) { return false; } return @m62Rcf::getRemoteClient($params); } catch (\Exception $e) { return false; } } } $rule = new Exists(); \JaegerApp\Validate::addrule($rule->getName(), array($rule, 'validate'), $rule->getErrorMessage());