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


PHP Feedback::setType方法代码示例

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


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

示例1: testHashOldInstance

 /**
  * Test #17.
  * The findByHash function returns an object populated with previous
  * values if a hash for a previous instance is given.
  * @depends testUpdate
  * @depends testHashGetInstance
  */
 public function testHashOldInstance()
 {
     global $testTripId1, $testReferenceId1, $testUserId1;
     // create the object and save it
     $object = new Feedback($testTripId1, $testReferenceId1, $testUserId1);
     $object->setType("like");
     $object->setDeleted('N');
     $this->assertTrue($object->save());
     $this->assertEquals(1, $this->countTestRows());
     $old_hash = $object->getHash();
     // change values and update the object
     $object->setType("off");
     $object->setDeleted('Y');
     $this->assertTrue($object->save());
     $this->assertEquals(2, $this->countTestRows());
     $new_hash = $object->getHash();
     // read the object from the database and confirm that the old
     // values are returned
     $object = Feedback::findByHash($old_hash);
     $this->assertNotNull($object);
     $this->assertEquals($testTripId1, $object->getTripId());
     $this->assertEquals($testReferenceId1, $object->getReferenceId());
     $this->assertEquals($testUserId1, $object->getUserId());
     $this->assertEquals("like", $object->getType());
     $this->assertEquals('N', $object->getDeleted());
     $this->assertEquals($old_hash, $object->getHash());
     // read the new object from the database and confirm that the new
     // values are returned
     $object = Feedback::findByHash($new_hash);
     $this->assertNotNull($object);
     $this->assertEquals($testTripId1, $object->getTripId());
     $this->assertEquals($testReferenceId1, $object->getReferenceId());
     $this->assertEquals($testUserId1, $object->getUserId());
     $this->assertEquals("off", $object->getType());
     $this->assertEquals('Y', $object->getDeleted());
     $this->assertEquals($new_hash, $object->getHash());
 }
开发者ID:egrivel,项目名称:vacationblog,代码行数:44,代码来源:FeedbackTest.php

示例2: getPostData

 } else {
     if (isPutMethod()) {
         $data = getPostData();
         if (isset($data['tripId']) && $data['tripId'] !== '' && isset($data['referenceId']) && $data['referenceId'] !== '' && isset($data['userId']) && $data['userId'] !== '') {
             $tripId = $data['tripId'];
             $referenceId = $data['referenceId'];
             $userId = $data['userId'];
             $object = new Feedback($tripId, $referenceId, $userId);
             if (isset($data['created'])) {
                 $object->setCreated($data['created']);
             }
             if (isset($data['updated'])) {
                 $object->setUpdated($data['updated']);
             }
             if (isset($data['type'])) {
                 $object->setType($data['type']);
             }
             if (isset($data['deleted'])) {
                 $object->setDeleted($data['deleted']);
             }
             if (isset($data['hash'])) {
                 $object->setHash($data['hash']);
             }
             if ($object->save()) {
                 $response = successResponse();
             } else {
                 // @codeCoverageIgnoreStart
                 // cannot unit test database errors
                 $response = errorResponse(RESPONSE_INTERNAL_ERROR);
                 // @codeCoverageIgnoreEnd
             }
开发者ID:egrivel,项目名称:vacationblog,代码行数:31,代码来源:synchFeedback.php

示例3: testSynchGetUnauthorized

 /**
  * @depends testSynchGetInvalid
  */
 public function testSynchGetUnauthorized()
 {
     global $testTripId1;
     global $testReferenceId1;
     global $testUserId1;
     global $adminAuthToken;
     // Create the object and set attributes
     $object = new Feedback($testTripId1, $testReferenceId1, $testUserId1);
     $object->setType('-type-1');
     $object->setDeleted('Y');
     // Save the object and confirm a row is added to the database
     $this->assertTrue($object->save());
     $this->assertEquals(1, $this->countTestRows());
     $data = array('hash' => $object->getHash());
     $result = getApi('synchFeedback.php', $data, $adminAuthToken);
     $this->assertEquals(RESPONSE_UNAUTHORIZED, $result['resultCode']);
 }
开发者ID:egrivel,项目名称:vacationblog,代码行数:20,代码来源:FeedbackApiTest.php

示例4: submitFeedback

 public static function submitFeedback()
 {
     $captcha = Core::validate(self::getVar('captcha'));
     $right_code = Session::getSessionVariable('security_code');
     Session::unsetSessionVariable('security_code');
     if ($captcha != $right_code) {
         Core::printErrorJson('Incorrect captcha');
         exit;
     }
     $usr = self::getCurrentUser(1);
     if (!isset($usr)) {
         header('Location: /');
         exit;
     }
     $feedback = array();
     $feedback['type'] = Core::validate(self::getVar('trouble-type'));
     $feedback['message'] = Core::validate(self::getVar('trouble'));
     $feedback['email'] = Core::validate(self::getVar('email'));
     $fbModel = new Feedback();
     $fbModel->setUID($usr->getId());
     $fbModel->setType($feedback['type']);
     $fbModel->setMessage($feedback['message']);
     $fbModel->setEmail($feedback['email']);
     $fbModel->insert();
     Core::printSuccessJson('Your ticket is active now!');
 }
开发者ID:Christian1998,项目名称:php_btc_exchange,代码行数:26,代码来源:usrController.php


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