Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PublicCookieMetadataTest.php
Go to the documentation of this file.
1 <?php
8 
12 
17 class PublicCookieMetadataTest extends \PHPUnit\Framework\TestCase
18 {
20  private $publicCookieMetadata;
21 
22  protected function setUp()
23  {
24  $objectManager = new ObjectManager($this);
25  $this->publicCookieMetadata = $objectManager->getObject(
26  \Magento\Framework\Stdlib\Cookie\PublicCookieMetadata::class
27  );
28  }
29 
36  public function testGetters($setMethodName, $getMethodName, $expectedValue)
37  {
38  $this->publicCookieMetadata->$setMethodName($expectedValue);
39  $this->assertSame($expectedValue, $this->publicCookieMetadata->$getMethodName());
40  }
41 
45  public function getMethodData()
46  {
47  return [
48  "getDomain" => ["setDomain", 'getDomain', "example.com"],
49  "getPath" => ["setPath", 'getPath', "path"],
50  "getDuration" => ["setDuration", 'getDuration', 125],
51  "getHttpOnly" => ["setHttpOnly", 'getHttpOnly', true],
52  "getSecure" => ["setSecure", 'getSecure', true],
53  "getDurationOneYear" => ["setDurationOneYear", 'getDuration', (3600*24*365)],
54  ];
55  }
56 }
$objectManager
Definition: bootstrap.php:17