Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ElementObjectTest.php
Go to the documentation of this file.
1 <?php
8 
12 
17 {
21  public function testTimeoutDefault()
22  {
23  $element = new ElementObject('name', 'type', 'selector', null, '-', false);
24  $this->assertNull($element->getTimeout());
25  }
26 
30  public function testTimeoutNotNull()
31  {
32  $element = new ElementObject('name', 'type', 'selector', null, '15', false);
33  $timeout = $element->getTimeout();
34  $this->assertEquals(15, $timeout);
35  $this->assertInternalType('int', $timeout);
36  }
37 
41  public function testTimeoutCastFromString()
42  {
43  $element = new ElementObject('name', 'type', 'selector', null, 'helloString', true);
44  $timeout = $element->getTimeout();
45  $this->assertEquals(0, $timeout);
46  $this->assertInternalType('int', $timeout);
47  }
48 
53  {
54  $this->expectException(XmlException::class);
55  new ElementObject('name', 'type', 'selector', 'cantHaveThisAndSelector', '-', false);
56  }
57 
62  {
63  $this->expectException(XmlException::class);
64  new ElementObject('name', 'type', null, null, '-', false);
65  }
66 }
$element
Definition: element.phtml:12