public function testRead() { $this->_initialConfigMock->expects($this->any())->method('getData')->with(ScopeConfigInterface::SCOPE_TYPE_DEFAULT)->will($this->returnValue(['config' => ['key1' => 'default_value1', 'key2' => 'default_value2']])); $this->_collectionFactory->expects($this->once())->method('create')->with(['scope' => 'default'])->will($this->returnValue([new \Magento\Framework\DataObject(['path' => 'config/key1', 'value' => 'default_db_value1']), new \Magento\Framework\DataObject(['path' => 'config/key3', 'value' => 'default_db_value3'])])); $expectedData = ['config' => ['key1' => 'default_db_value1', 'key2' => 'default_value2', 'key3' => 'default_db_value3']]; $this->assertEquals($expectedData, $this->_model->read()); }
public function testRead() { $this->_initialConfigMock->expects($this->any())->method('getData')->with(\Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT)->will($this->returnValue(array('config' => array('key1' => 'default_value1', 'key2' => 'default_value2')))); $this->_collectionFactory->expects($this->once())->method('create')->with(array('scope' => 'default'))->will($this->returnValue(array(new \Magento\Framework\Object(array('path' => 'config/key1', 'value' => 'default_db_value1')), new \Magento\Framework\Object(array('path' => 'config/key3', 'value' => 'default_db_value3'))))); $expectedData = array('config' => array('key1' => 'default_db_value1', 'key2' => 'default_value2', 'key3' => 'default_db_value3')); $this->assertEquals($expectedData, $this->_model->read()); }
/** * Testing method execution */ public function testGet() { $job1 = ['schedule' => ['cron_expr' => '* * * * *']]; $job2 = ['schedule' => ['cron_expr' => '1 1 1 1 1']]; $data = ['crontab' => ['default' => ['jobs' => ['job1' => $job1, 'job2' => $job2]]]]; $this->_defaultReader->expects($this->once())->method('read')->will($this->returnValue($data)); $expected = ['default' => ['job1' => ['schedule' => $job1['schedule']['cron_expr']], 'job2' => ['schedule' => $job2['schedule']['cron_expr']]]]; $result = $this->_reader->get(); $this->assertEquals($expected['default']['job1']['schedule'], $result['default']['job1']['schedule']); $this->assertEquals($expected['default']['job2']['schedule'], $result['default']['job2']['schedule']); }