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


PHP Feedback::setUpdated方法代码示例

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


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

示例1: testOverrideAutomaticAttributesFutureDate

 /**
  * test #14.
  * Overriding automatic attributes using a future date. Because
  * a future date is used, the record can no longer be changed after
  * it was saved.
  * @depends testSaveEmptyObject
  * @depends testSetAttributes
  * @depends testUpdate
  * @depends testOverrideAutomaticAttributesNewRecord
  */
 public function testOverrideAutomaticAttributesFutureDate()
 {
     global $testTripId1, $testReferenceId1, $testUserId1;
     // Create the object, which automatically gets the current date
     $object = new Feedback($testTripId1, $testReferenceId1, $testUserId1);
     $object->setType('like');
     $object->setDeleted('Y');
     $this->assertTrue($object->save());
     $this->assertEquals(1, $this->countTestRows());
     $originalCreated = $object->getCreated();
     $originalUpdated = $object->getUpdated();
     $originalHash = $object->getHash();
     // Change the object with different values, using a guaranteed
     // future date for the Created and Updated fields. Note that
     // the mySQL timestamp values allow for dates up to January 19,
     // 2038. Select as the future date for this test January 18, 2038
     // values after first save are unchanged
     $object->setCreated('2038-01-18 10:10:10.000000');
     $object->setUpdated('2038-01-18 10:10:11.000000');
     $object->setType('plus');
     $object->setDeleted('N');
     $object->setHash('future date hash');
     // Check the values before saving
     $this->assertEquals($testTripId1, $object->getTripId());
     $this->assertEquals($testReferenceId1, $object->getReferenceId());
     $this->assertEquals($testUserId1, $object->getUserId());
     $this->assertEquals('2038-01-18 10:10:10.000000', $object->getCreated());
     $this->assertEquals('2038-01-18 10:10:11.000000', $object->getUpdated());
     $this->assertEquals('plus', $object->getType());
     $this->assertEquals('N', $object->getDeleted());
     $this->assertEquals('future date hash', $object->getHash());
     // update the record, this adds a row in the database
     $this->assertTrue($object->save());
     $this->assertEquals(2, $this->countTestRows());
     // after the update, the information has been saved
     $this->assertEquals($testTripId1, $object->getTripId());
     $this->assertEquals($testReferenceId1, $object->getReferenceId());
     $this->assertEquals($testUserId1, $object->getUserId());
     $this->assertEquals('2038-01-18 10:10:10.000000', $object->getCreated());
     $this->assertEquals('2038-01-18 10:10:11.000000', $object->getUpdated());
     $this->assertEquals('plus', $object->getType());
     $this->assertEquals('N', $object->getDeleted());
     $this->assertEquals('future date hash', $object->getHash());
     // Try to update the record. This will add a row in the database
     $object->setType('hugs');
     $object->setDeleted('Y');
     $this->assertTrue($object->save());
     $this->assertEquals(3, $this->countTestRows());
     // but the new information is not saved. The previously saved
     // information cannot be overwritten without manually setting the
     // updated field.
     $this->assertEquals($testTripId1, $object->getTripId());
     $this->assertEquals($testReferenceId1, $object->getReferenceId());
     $this->assertEquals($testUserId1, $object->getUserId());
     $this->assertEquals('2038-01-18 10:10:10.000000', $object->getCreated());
     $this->assertEquals('2038-01-18 10:10:11.000000', $object->getUpdated());
     $this->assertEquals('plus', $object->getType());
     $this->assertEquals('N', $object->getDeleted());
     // Note: this will FAIL in the current implementation!
     //$this->assertEquals('future date hash', $object->getHash());
 }
开发者ID:egrivel,项目名称:vacationblog,代码行数:71,代码来源:FeedbackTest.php

示例2: errorResponse

     } else {
         $response = errorResponse(RESPONSE_BAD_REQUEST);
     }
 } 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
开发者ID:egrivel,项目名称:vacationblog,代码行数:31,代码来源:synchFeedback.php


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