Skip to content

Commit 863f77b

Browse files
committed
test(Install): check the versions in all files where they appear
1 parent 7b9234b commit 863f77b

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@
3535
"license-headers": "vendor/bin/licence-headers-check --ansi --no-interaction",
3636
"build-schema": "tools/build-db-schema.php carbon | plantuml -p -tpng > docs/db-schema.png"
3737
},
38-
"version": "1.0.0-beta.3"
39-
}
38+
"version": "1.2.0-beta.1"
39+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "carbon",
33
"description": "Measurement of carbon emissions of GLPI devices",
44
"license": "GPL-3.0-or-later",
5-
"version": "1.0.0-beta.3",
5+
"version": "1.2.0-beta.1",
66
"dependencies": {
77
"apexcharts": "^3.49.0"
88
},

tests/install/PluginInstallTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public function testInstallPlugin()
141141
$plugin->init();
142142
$this->assertTrue(Plugin::isPluginActive(TEST_PLUGIN_NAME), 'Plugin not activated');
143143
$this->checkSchema(PLUGIN_CARBON_VERSION);
144+
$this->checkVersionInAllFiles();
144145

145146
$this->checkConfig();
146147
$this->checkAutomaticAction();
@@ -911,4 +912,22 @@ public function checkRegisteredClasses()
911912
$expected = ['GlpiPlugin\Carbon\NetworkEquipmentModel'];
912913
$this->assertEquals($expected, $result);
913914
}
915+
916+
#[CoversNothing()]
917+
public function checkVersionInAllFiles()
918+
{
919+
$setup_version = PLUGIN_CARBON_VERSION;
920+
$plugin_dir = dirname(__DIR__, 2);
921+
$composer_file = $plugin_dir . '/composer.json';
922+
$package_file = $plugin_dir . '/package.json';
923+
$package_lock_file = $plugin_dir . '/package-lock.json';
924+
925+
$composer = json_decode(file_get_contents($composer_file), true);
926+
$package = json_decode(file_get_contents($package_file), true);
927+
$package_lock = json_decode(file_get_contents($package_lock_file), true);
928+
929+
$this->assertSame($setup_version, $composer['version'] ?? null);
930+
$this->assertSame($setup_version, $package['version'] ?? null);
931+
$this->assertSame($setup_version, $package_lock['version'] ?? null);
932+
}
914933
}

0 commit comments

Comments
 (0)