@@ -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