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


PHP ElggObject::getCurrentTime方法代码示例

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


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

示例1: testCanSaveNewObject

 /**
  * @group current
  */
 public function testCanSaveNewObject()
 {
     $subtype = 'test_subtype';
     $subtype_id = add_subtype('object', $subtype);
     $user = $this->mocks()->getUser();
     _elgg_services()->session->setLoggedInUser($user);
     $object = new \ElggObject();
     $object->subtype = $subtype;
     $object->title = 'Foo';
     $object->description = 'Bar';
     $object->owner_guid = $user->guid;
     $object->container_guid = $user->guid;
     $object->access_id = ACCESS_LOGGED_IN;
     $object->time_created = time();
     $object->setCurrentTime();
     // We should be able to match timestamps
     $now = $object->getCurrentTime()->getTimestamp();
     $guid = $object->save();
     $this->assertNotFalse($guid);
     $object = get_entity($guid);
     $this->assertEquals('object', $object->type);
     $this->assertEquals($subtype_id, $object->subtype);
     $this->assertEquals('Foo', $object->title);
     $this->assertEquals('Foo', $object->getDisplayName());
     $this->assertEquals('Bar', $object->description);
     $this->assertEquals($user->guid, $object->getOwnerGUID());
     $this->assertEquals($user, $object->getOwnerEntity());
     $this->assertEquals($user->guid, $object->getContainerGUID());
     $this->assertEquals($user, $object->getContainerEntity());
     $this->assertEquals(ACCESS_LOGGED_IN, $object->access_id);
     _elgg_services()->session->removeLoggedInUser();
 }
开发者ID:elgg,项目名称:elgg,代码行数:35,代码来源:ElggObjectTest.php


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