Пример #1
0
 public function testIsValueChanged()
 {
     // load the model
     $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Core\\Model\\Resource\\Config\\Data\\Collection');
     $collection->addFieldToFilter('path', self::SAMPLE_CONFIG_PATH)->addFieldToFilter('scope_id', 0)->addFieldToFilter('scope', 'default');
     foreach ($collection as $configData) {
         $this->_model = $configData;
         break;
     }
     $this->assertNotEmpty($this->_model->getId());
     // assert
     $this->assertFalse($this->_model->isValueChanged());
     $this->_model->setValue(uniqid());
     $this->assertTrue($this->_model->isValueChanged());
 }
Пример #2
0
 /**
  * @param int $callNumber
  * @param string $oldValue
  * @dataProvider afterSaveDataProvider
  */
 public function testAfterSave($callNumber, $oldValue)
 {
     $this->cacheTypeListMock->expects($this->exactly($callNumber))->method('invalidate');
     $this->configMock->expects($this->any())->method('getValue')->willReturn($oldValue);
     $this->model->setValue('some_value');
     $this->assertInstanceOf(get_class($this->model), $this->model->afterSave());
 }
Пример #3
0
 /**
  * @param string $oldValue
  * @param string $value
  * @param bool $result
  * @dataProvider dataIsValueChanged
  */
 public function testIsValueChanged($oldValue, $value, $result)
 {
     $this->configMock->expects($this->once())->method('getValue')->with(null, 'default')->will($this->returnValue($oldValue));
     $this->model->setValue($value);
     $this->assertEquals($result, $this->model->isValueChanged());
 }