Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
BackendModelTest.php
Go to the documentation of this file.
1 <?php
8 
11 
12 class BackendModelTest extends \PHPUnit\Framework\TestCase
13 {
17  public function testBeforeSave($value, $errorMessage = null)
18  {
20  $model = (new ObjectManager($this))->getObject(
21  \Magento\Backend\Model\Config\SessionLifetime\BackendModel::class
22  );
23  if ($errorMessage !== null) {
24  $this->expectException(\Magento\Framework\Exception\LocalizedException::class);
25  $this->expectExceptionMessage($errorMessage);
26  }
27  $model->setValue($value);
28  $object = $model->beforeSave();
29  $this->assertEquals($model, $object);
30  }
31 
36  {
37  return [
38  [
40  'The Admin session lifetime is invalid. Set the lifetime to 60 seconds or longer and try again.'
41  ],
42  [
44  'The Admin session lifetime is invalid. '
45  . 'Set the lifetime to 31536000 seconds (one year) or shorter and try again.'
46  ],
47  [
48  900
49  ]
50  ];
51  }
52 }
$value
Definition: gender.phtml:16