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


PHP Messages::getError方法代码示例

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


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

示例1: testInvalidUserDataIdSkillAssocsCreate

 public function testInvalidUserDataIdSkillAssocsCreate()
 {
     $validSkillId = 11;
     $invalidUserDataId = -3;
     $s1 = new SkillAssocs($invalidUserDataId, $validSkillId);
     $this->assertTrue(!empty($s1->getError('userDataId')) && strcmp(Messages::getError('USER_DATA_ID_INVALID'), $s1->getError('userDataId')) == 0, 'It should have a userDataId error if the userDataId is invalid');
 }
开发者ID:mr-augustine,项目名称:sensor-data-repo,代码行数:7,代码来源:SkillAssocsTest.php

示例2: testInvalidCreatorIdRobotAssocCreate

 public function testInvalidCreatorIdRobotAssocCreate()
 {
     $validRobotId = 1;
     $invalidCreatorId = -20;
     $s1 = new RobotAssoc($validRobotId, $invalidCreatorId);
     $this->assertTrue(!empty($s1->getError('creatorId')) && strcmp(Messages::getError('CREATOR_ID_INVALID'), $s1->getError('creatorId')) == 0, 'It should have a creatorId error if the creatorId is invalid');
 }
开发者ID:mr-augustine,项目名称:sensor-data-repo,代码行数:7,代码来源:RobotAssocTest.php

示例3: setError

 public function setError($errorName, $errorValue)
 {
     // Sets a particular error value and increments error count
     if (!isset($this->errors, $errorName)) {
         $this->errors[$errorName] = Messages::getError($errorValue);
         $this->errorCount++;
     }
 }
开发者ID:bennilyn,项目名称:examples,代码行数:8,代码来源:Review.class.php

示例4: setError

 public function setError($errorName, $errorValue)
 {
     // Set a particular error value and increments error count
     if (!array_key_exists($errorName, $this->errors)) {
         $this->errors[$errorName] = Messages::getError($errorValue);
         $this->errorCount++;
     }
 }
开发者ID:Trivette,项目名称:cs4413,代码行数:8,代码来源:Team.class.php

示例5: testInvalidCreatorRobotDataCreate

 public function testInvalidCreatorRobotDataCreate()
 {
     $validRobotName = "TARS";
     $invalidCreators = array("-2");
     $validStatus = "in-development";
     $s1 = new RobotData(array("robot_name" => $validRobotName, "creators" => $invalidCreators, "status" => $validStatus));
     $this->assertTrue(!empty($s1->getError('creator')) && strcmp(Messages::getError('ROBOT_CREATOR_INVALID'), $s1->getError('creator')) == 0, 'It should have a creator error if the creator id is invalid');
 }
开发者ID:mr-augustine,项目名称:sensor-data-repo,代码行数:8,代码来源:RobotDataTest.php

示例6: testInsertDuplicateRobotData

 public function testInsertDuplicateRobotData()
 {
     $myDb = DBMaker::create('botspacetest');
     Database::clearDB();
     $db = Database::getDB('botspacetest', 'C:\\xampp\\myConfig.ini');
     $beforeCount = count(RobotDataDB::getRobotDataBy());
     $robotDataCopy = RobotDataDB::getRobotDataBy('robotId', 2);
     $robotDataCopy = $robotDataCopy[0];
     $this->assertEquals(0, $robotDataCopy->getErrorCount(), 'The robot data copy object should have no errors');
     $dupRobotData = RobotDataDB::addRobotData($robotDataCopy);
     $afterCount = count(RobotDataDB::getRobotDataBy());
     $this->assertTrue(!empty($dupRobotData->getError('robotId')) && strcmp(Messages::getError('ROBOT_DATA_INVALID'), $dupRobotData->getError('robotId')) == 0, 'It should have a robotDataId error if the robot data is a duplicate');
     $this->assertEquals($afterCount, $beforeCount, 'There should be no additional robot data entries after the insertion attempt');
 }
开发者ID:mr-augustine,项目名称:sensor-data-repo,代码行数:14,代码来源:RobotDataDBTest.php

示例7: testInsertDuplicateRobotAssoc

 public function testInsertDuplicateRobotAssoc()
 {
     $myDB = DBMaker::create('botspacetest');
     Database::clearDB();
     $db = Database::getDB('botspacetest', 'C:\\xampp\\myConfig.ini');
     $beforeCount = count(RobotAssocsDB::getRobotAssocsBy());
     $robotAssocCopy = RobotAssocsDB::getRobotAssocsRowsBy('robotAssocId', 2);
     $robotAssocCopy = $robotAssocCopy[0];
     $s1 = new RobotAssoc($robotAssocCopy);
     $dupRobotAssoc = RobotAssocsDB::addRobotAssoc($s1);
     $afterCount = count(RobotAssocsDB::getRobotAssocsBy());
     $this->assertTrue(!empty($dupRobotAssoc->getError('robotAssocId')) && strcmp(Messages::getError('ROBOT_ASSOC_INVALID'), $s1->getError('robotAssocId')) == 0, 'It should have a robotAssocId error if the robot association is a duplicate');
     $this->assertEquals($afterCount, $beforeCount, 'There should be no additional robot association entries after the insertion attempt');
 }
开发者ID:mr-augustine,项目名称:sensor-data-repo,代码行数:14,代码来源:RobotAssocsDBTest.php

示例8: empty

?>

<h2>It should set errors from a file</h2>
<?php 
Messages::setErrors("../resources/errors_English.txt");
echo "LAST_NAME_TOO_SHORT: " . Messages::getError("LAST_NAME_TOO_SHORT") . "<br>";
echo "EMAIL_INVALID: " . Messages::getError("EMAIL_INVALID") . "<br>";
echo "LAST_NAME_INVALID: " . Messages::getError("LAST_NAME_HAS_INVALID_CHARS") . "<br>";
echo empty(Messages::getError("LAST_NAME_TOO_SHORT")) ? "Failed: it did not set LAST_NAME_TOO_SHORT from file" : "";
?>

<h2>It should allow reset</h2>
<?php 
Messages::reset();
echo "LAST_NAME_TOO_SHORT: " . Messages::getError("LAST_NAME_TOO_SHORT") . "<br>";
echo "EMAIL_INVALID: " . Messages::getError("EMAIL_INVALID") . "<br>";
echo "LAST_NAME_HAS_INVALID_CHARS: " . Messages::getError("LAST_NAME_HAS_INVALID_CHARS") . "<br>";
?>

<h2>It should allow change of locale</h2>
<?php 
Messages::$locale = 'Spanish';
Messages::reset();
echo "LAST_NAME_TOO_SHORT: " . Messages::getError("LAST_NAME_TOO_SHORT") . "<br>";
echo "EMAIL_INVALID: " . Messages::getError("EMAIL_INVALID") . "<br>";
echo "LAST_NAME_HAS_INVALID_CHARS: " . Messages::getError("LAST_NAME_HAS_INVALID_CHARS") . "<br>";
?>
</body>
</html>

开发者ID:bennilyn,项目名称:examples,代码行数:29,代码来源:Messages_tests.php

示例9: setError

 public function setError($errorName, $errorValue)
 {
     $this->errors[$errorName] = Messages::getError($errorValue);
     $this->errorCount++;
 }
开发者ID:mr-augustine,项目名称:sensor-data-repo,代码行数:5,代码来源:Sensor.class.php

示例10: testHasNoMessage

 public function testHasNoMessage()
 {
     Messages::reset();
     $errorMessage = Messages::getError("GIANTS_ARE_HERE");
     $this->assertTrue(empty($errorMessage), 'It should not have an error messages for giants');
 }
开发者ID:bennilyn,项目名称:examples,代码行数:6,代码来源:MessagesTest.php

示例11: testInvalidSkillName

 public function testInvalidSkillName()
 {
     $invalidTest = array("skill_name" => "compooter-vision");
     $s1 = new Skill($invalidTest);
     $this->assertTrue(!empty($s1->getError('skill_name')) && strcmp(Messages::getError('SKILL_AREA_INVALID'), $s1->getError('skill_name')) == 0, 'It should have a skill_name error if the name is invalid');
 }
开发者ID:mr-augustine,项目名称:sensor-data-repo,代码行数:6,代码来源:SkillTest.php

示例12: setError

 public function setError($name, $error)
 {
     if (!array_key_exists($name, $this->errors)) {
         $this->errors[$name] = Messages::getError($error);
         $this->hasErrors = true;
     }
 }
开发者ID:mikeschap,项目名称:WithTheClothesOnYourBack,代码行数:7,代码来源:User.class.php

示例13: empty

<?php 
include_once "../models/Messages.class.php";
?>

<h2>It should set errors from a file</h2>
<?php 
Messages::setErrors("../resources/errors_English.txt");
echo "LAST_NAME_TOO_SHORT: " . Messages::getError("LAST_NAME_TOO_SHORT") . "<br>";
echo "EMAIL_INVALID: " . Messages::getError("EMAIL_INVALID") . "<br>";
echo "LAST_NAME_INVALID: " . Messages::getError("LAST_NAME_HAS_INVALID_CHARS") . "<br>";
echo empty(Messages::getError("LAST_NAME_TOO_SHORT")) ? "Failed: it did not set LAST_NAME_TOO_SHORT from file" : "";
?>

<h2>It should allow reset</h2>
<?php 
Messages::reset();
echo "LAST_NAME_TOO_SHORT: " . Messages::getError("LAST_NAME_TOO_SHORT") . "<br>";
echo "EMAIL_INVALID: " . Messages::getError("EMAIL_INVALID") . "<br>";
echo "LAST_NAME_HAS_INVALID_CHARS: " . Messages::getError("LAST_NAME_HAS_INVALID_CHARS") . "<br>";
?>

<h2>It should return blank for messages that don't exist</h2>
<?php 
Messages::reset();
echo "GIANTS_ARE_HERE: " . Messages::getError("GIANTS_ARE_HERE") . "<br>";
?>

</body>
</html>

开发者ID:bennilyn,项目名称:examples,代码行数:29,代码来源:Messages_tests.php

示例14:

<h2>It should allow change of locale</h2>
<?php 
Messages::$locale = 'German';
Messages::reset();
echo "EMAIL_EMPTY: " . Messages::getError("EMAIL_EMPTY") . "<br>";
echo "EMAIL_INVALID: " . Messages::getError("EMAIL_INVALID") . "<br>";
echo "USER_NAME_EMPTY: " . Messages::getError("USER_NAME_EMPTY") . "<br>";
echo "USER_NAME_TOO_SHORT: " . Messages::getError("USER_NAME_TOO_SHORT") . "<br>";
echo "USER_NAME_HAS_INVALID_CHARS: " . Messages::getError("USER_NAME_HAS_INVALID_CHARS") . "<br>";
echo "SKILL_AREA_INVALID: " . Messages::getError("SKILL_AREA_INVALID") . "<br>";
echo "SKILL_LEVEL_INVALID: " . Messages::getError("SKILL_LEVEL_INVALID") . "<br>";
echo "SKILL_LEVEL_NOT_SET: " . Messages::getError("SKILL_LEVEL_NOT_SET") . "<br>";
echo "PASSWORD_EMPTY: " . Messages::getError("PASSWORD_EMPTY") . "<br>";
echo "PASSWORD_TOO_SHORT: " . Messages::getError("PASSWORD_TOO_SHORT") . "<br>";
echo "PROFILE_PIC_WRONG_TYPE: " . Messages::getError("PROFILE_PIC_WRONG_TYPE") . "<br>";
echo "HOBBY_DATE_EMPTY: " . Messages::getError("HOBBY_DATE_EMPTY") . "<br>";
echo "HOBBY_DATE_FORMAT_INVALID: " . Messages::getError("HOBBY_DATE_FORMAT_INVALID") . "<br>";
echo "HOBBY_DATE_INVALID: " . Messages::getError("HOBBY_DATE_INVALID") . "<br>";
echo "FAV_COLOR_EMPTY: " . Messages::getError("FAV_COLOR_EMPTY") . "<br>";
echo "FAV_COLOR_INVALID: " . Messages::getError("FAV_COLOR_INVALID") . "<br>";
echo "URL_INVALID: " . Messages::getError("URL_INVALID") . "<br>";
echo "PHONE_NUMBER_INVALID: " . Messages::getError("PHONE_NUMBER_INVALID") . "<br>";
echo "ROBOT_NAME_EMPTY: " . Messages::getError("ROBOT_NAME_EMPTY") . "<br>";
echo "ROBOT_CREATOR_EMPTY: " . Messages::getError("ROBOT_CREATOR_EMPTY") . "<br>";
echo "ROBOT_STATUS_EMPTY: " . Messages::getError("ROBOT_STATUS_EMPTY") . "<br>";
echo "ROBOT_STATUS_INVALID: " . Messages::getError("ROBOT_STATUS_INVALID") . "<br>";
?>
</body>
</html>

开发者ID:mr-augustine,项目名称:sensor-data-repo,代码行数:29,代码来源:Messages_tests.php

示例15: testInsertDuplicateSkillAssoc

 public function testInsertDuplicateSkillAssoc()
 {
     $myDB = DBMaker::create('botspacetest');
     Database::clearDB();
     $db = Database::getDB('botspacetest', 'C:\\xampp\\myConfig.ini');
     $beforeCount = count(SkillAssocsDB::getSkillAssocsBy());
     $skillAssocCopy = SkillAssocsDB::getSkillAssocsRowsBy('skillAssocId', 4);
     $skillAssocCopy = $skillAssocCopy[0];
     $s1 = new SkillAssocs($skillAssocCopy);
     $dupSkillAssoc = SkillAssocsDB::addSkillAssoc($s1);
     $afterCount = count(SkillAssocsDB::getSkillAssocsBy());
     $this->assertTrue(!empty($dupSkillAssoc->getError('skillAssocId')) && strcmp(Messages::getError('SKILL_ASSOC_INVALID'), $dupSkillAssoc->getError('skillAssocId')) == 0, 'It should have a skillAssocId error if the skill association is a duplicate');
     $this->assertEquals($afterCount, $beforeCount, 'There should be no additional skill associations entries after the insertion attempt');
 }
开发者ID:mr-augustine,项目名称:sensor-data-repo,代码行数:14,代码来源:SkillAssocsDBTest.php


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