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


PHP MetadataBag::initialize方法代码示例

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


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

示例1: testGetLifetime

 public function testGetLifetime()
 {
     $bag = new MetadataBag();
     $array = array(MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 1000);
     $bag->initialize($array);
     $this->assertEquals(1000, $bag->getLifetime());
 }
开发者ID:d3ancole1995,项目名称:symfony,代码行数:7,代码来源:MetadataBagTest.php

示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->bag = new MetadataBag();
     $this->array = array(MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 0);
     $this->bag->initialize($this->array);
 }
开发者ID:saj696,项目名称:pipe,代码行数:7,代码来源:MetadataBagTest.php

示例3: testInitialize

 public function testInitialize()
 {
     $p = new \ReflectionProperty('Symfony\\Component\\HttpFoundation\\Session\\Storage\\MetadataBag', 'meta');
     $p->setAccessible(true);
     $bag1 = new MetadataBag();
     $array = array();
     $bag1->initialize($array);
     $this->assertGreaterThanOrEqual(time(), $bag1->getCreated());
     $this->assertEquals($bag1->getCreated(), $bag1->getLastUsed());
     sleep(1);
     $bag2 = new MetadataBag();
     $array2 = $p->getValue($bag1);
     $bag2->initialize($array2);
     $this->assertEquals($bag1->getCreated(), $bag2->getCreated());
     $this->assertEquals($bag1->getLastUsed(), $bag2->getLastUsed());
     $this->assertEquals($bag2->getCreated(), $bag2->getLastUsed());
     sleep(1);
     $bag3 = new MetadataBag();
     $array3 = $p->getValue($bag2);
     $bag3->initialize($array3);
     $this->assertEquals($bag1->getCreated(), $bag3->getCreated());
     $this->assertGreaterThan($bag2->getLastUsed(), $bag3->getLastUsed());
     $this->assertNotEquals($bag3->getCreated(), $bag3->getLastUsed());
 }
开发者ID:laubosslink,项目名称:lab,代码行数:24,代码来源:MetadataBagTest.php

示例4: testDoesNotSkipLastUsedUpdate

 public function testDoesNotSkipLastUsedUpdate()
 {
     $bag = new MetadataBag('', 30);
     $timeStamp = time();
     $created = $timeStamp - 45;
     $sessionMetadata = array(MetadataBag::CREATED => $created, MetadataBag::UPDATED => $created, MetadataBag::LIFETIME => 1000);
     $bag->initialize($sessionMetadata);
     $this->assertEquals($timeStamp, $sessionMetadata[MetadataBag::UPDATED]);
 }
开发者ID:neteasy-work,项目名称:hkgbf_crm,代码行数:9,代码来源:MetadataBagTest.php


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