コード例 #1
0
    public function testInvalidCallback()
    {
        $valid = new Callback(array($this, 'objectCallback'));

        $this->setExpectedException('Zend\Validator\Exception\InvalidArgumentException', 'Invalid callback given');
        $valid->setCallback('invalidcallback');
    }
コード例 #2
0
 /**
  * Create the Callback validator that will be used to ensure the
  * RowCollectionEditor is valid.  We iterate over all the editors it has,
  * pass data to the editor via isValid() and return an error message if any
  * editor fails.
  *
  * @return Callback
  */
 protected function createCallbackValidator()
 {
     $validator = new Callback();
     $validator->setCallback(function () {
         return $this->rowCollectionEditor->isValid();
     });
     $validator->setMessage("Some errors were found in your {$this->rowCollectionEditor->getPluralTitle()}.\n            Please double-check and try again.", Callback::INVALID_VALUE);
     return $validator;
 }
コード例 #3
0
ファイル: CallbackTest.php プロジェクト: bradley-holt/zf2
 public function testInvalidCallback()
 {
     $valid = new Validator\Callback(array($this, 'objectCallback'));
     try {
         $valid->setCallback('invalidcallback');
         $this->fail('Exception expected');
     } catch (\Zend\Exception $e) {
         $this->assertContains('Invalid callback given', $e->getMessage());
     }
 }