15 private $dbVersionInfo;
25 private $moduleResource;
30 private $_outputConfig;
34 $this->moduleList = $this->getMockForAbstractClass(\
Magento\Framework\Module\ModuleListInterface::class);
35 $this->moduleList->expects($this->any())
37 ->will($this->returnValueMap([
38 [
'Module_One', [
'name' =>
'Module_One',
'setup_version' =>
'1']],
39 [
'Module_Two', [
'name' =>
'Module_Two',
'setup_version' =>
'2']],
40 [
'Module_No_Schema', []],
42 $this->moduleList->expects($this->any())
44 ->will($this->returnValue([
'Module_One',
'Module_Two']));
46 $this->_outputConfig = $this->getMockForAbstractClass(\
Magento\Framework\Module\Output\ConfigInterface::class);
47 $this->moduleResource = $this->getMockForAbstractClass(\
Magento\Framework\Module\ResourceInterface::class);
64 $this->moduleResource->expects($this->once())
65 ->method(
'getDbVersion')
67 ->will($this->returnValue($dbVersion));
68 $this->moduleList->expects(self::once())
72 [
'setup_version' => $dbVersion]
76 $this->dbVersionInfo->isSchemaUpToDate($moduleName)
89 $this->moduleResource->expects($this->once())
90 ->method(
'getDataVersion')
92 ->will($this->returnValue($dbVersion));
93 $this->moduleList->expects(self::once())
97 [
'setup_version' => $dbVersion]
101 $this->dbVersionInfo->isDataUpToDate($moduleName)
111 'version in config == version in db' => [
'Module_One',
'1',
true],
112 'version in config < version in db' => [
117 'version in config > version in db' => [
122 'no version in db' => [
132 $this->moduleResource->expects($this->any())
133 ->method(
'getDataVersion')
134 ->will($this->returnValue(2));
135 $this->moduleResource->expects($this->any())
136 ->method(
'getDbVersion')
137 ->will($this->returnValue(2));
153 $this->assertEquals($expectedErrors, $this->dbVersionInfo->getDbVersionErrors());
161 $this->assertTrue($this->dbVersionInfo->isSchemaUpToDate(
'Module_No_Schema'));
169 $this->assertTrue($this->dbVersionInfo->isDataUpToDate(
'Module_No_Schema'));
testIsDbDataUpToDate($moduleName, $dbVersion, $expectedResult)
isDbUpToDateDataProvider()
testIsDbDataUpToDateException()
testIsDbSchemaUpToDateException()
testIsDbSchemaUpToDate($moduleName, $dbVersion, $expectedResult)