當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。