当前位置: 首页>>代码示例>>PHP>>正文


PHP ValidationTest1类代码示例

本文整理汇总了PHP中ValidationTest1的典型用法代码示例。如果您正苦于以下问题:PHP ValidationTest1类的具体用法?PHP ValidationTest1怎么用?PHP ValidationTest1使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ValidationTest1类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testAllowSimulatedFields

 /**
  * Tests validation parameter order in custom validation methods
  *
  * @return void
  */
 public function testAllowSimulatedFields()
 {
     $TestModel = new ValidationTest1();
     $TestModel->create(array('title' => 'foo', 'bar' => 'baz'));
     $expected = array('ValidationTest1' => array('title' => 'foo', 'bar' => 'baz'));
     $this->assertEquals($expected, $TestModel->data);
 }
开发者ID:manzapanza,项目名称:cakephp-api-utils,代码行数:12,代码来源:ModelWriteTest.php

示例2: testInvalidAssociation

 /**
  * Tests validation parameter order in custom validation methods
  *
  * @return void
  */
 public function testInvalidAssociation()
 {
     $TestModel = new ValidationTest1();
     $this->assertNull($TestModel->getAssociated('Foo'));
 }
开发者ID:agashish,项目名称:test_new,代码行数:10,代码来源:ModelIntegrationTest.php

示例3: testValidationMessageAsArray

 /**
  * Test placeholder replacement when validation message is an array
  *
  * @return void
  */
 public function testValidationMessageAsArray()
 {
     $TestModel = new ValidationTest1();
     $TestModel->validate = array('title' => array('minLength' => array('rule' => array('minLength', 6), 'required' => true, 'message' => 'Minimum length allowed is %d chars', 'last' => false), 'between' => array('rule' => array('between', 5, 15), 'message' => array('You may enter up to %s chars (minimum is %s chars)', 14, 6))));
     $TestModel->create();
     $TestModel->invalidFields();
     $expected = array('title' => array('Minimum length allowed is 6 chars'));
     $this->assertEquals($TestModel->validationErrors, $expected);
     $TestModel->create(array('title' => 'foo'));
     $TestModel->invalidFields();
     $expected = array('title' => array('Minimum length allowed is 6 chars', 'You may enter up to 14 chars (minimum is 6 chars)'));
     $this->assertEquals($TestModel->validationErrors, $expected);
 }
开发者ID:MrGrigorev,项目名称:reserva-de-salas,代码行数:18,代码来源:ModelValidationTest.php

示例4: testValidationMessageTranslation

 /**
  * Test validation message translation
  *
  * @return void
  */
 public function testValidationMessageTranslation()
 {
     $lang = Configure::read('Config.language');
     Configure::write('Config.language', 'en');
     App::build(array('Locale' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Locale' . DS)), App::RESET);
     $TestModel = new ValidationTest1();
     $TestModel->validationDomain = 'validation_messages';
     $TestModel->validate = array('title' => array(array('rule' => array('customValidationMethod', 'arg1'), 'required' => true, 'message' => 'Validation failed: %s')));
     $TestModel->create();
     $expected = array('title' => array('Translated validation failed: Translated arg1'));
     $TestModel->invalidFields();
     $this->assertEquals($expected, $TestModel->validationErrors);
     $TestModel->validationDomain = 'default';
     Configure::write('Config.language', $lang);
     App::build();
 }
开发者ID:kuradakis,项目名称:cakephp-ex,代码行数:21,代码来源:ModelValidationTest.php

示例5: testMissingValidationErrorNoTriggering

 /**
  * Test that missing validation methods does not trigger errors in production mode.
  *
  * @return void
  */
 public function testMissingValidationErrorNoTriggering()
 {
     Configure::write('debug', 0);
     $TestModel = new ValidationTest1();
     $TestModel->create(array('title' => 'foo'));
     $TestModel->validate = array('title' => array('rule' => array('thisOneBringsThePain'), 'required' => true));
     $TestModel->invalidFields(array('fieldList' => array('title')));
     $this->assertEquals($TestModel->validationErrors, array());
 }
开发者ID:Nervie,项目名称:Beta,代码行数:14,代码来源:ModelValidationTest.php


注:本文中的ValidationTest1类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。