diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1f06f77c0..0d99d6fc8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,7 +12,8 @@
- class event : Thelia\Core\Event\SessionEvent
- example : Thelia\Core\EventListener\SessionListener
- Creation of Thelia\Core\TheliakernelEvents class for referencing kernel event
-
+- Add new command line that refresh modules list `Thelia module:refresh`
+
#2.0.1
- possibility to apply a permanent discount on a customer
diff --git a/core/lib/Thelia/Command/ModuleRefreshCommand.php b/core/lib/Thelia/Command/ModuleRefreshCommand.php
new file mode 100644
index 000000000..318542939
--- /dev/null
+++ b/core/lib/Thelia/Command/ModuleRefreshCommand.php
@@ -0,0 +1,54 @@
+
+ */
+class ModuleRefreshCommand extends ContainerAwareCommand
+{
+ protected function configure()
+ {
+ $this
+ ->setName('module:refresh')
+ ->setDescription('Refresh modules list');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ try {
+ $moduleManagement = new ModuleManagement;
+ $moduleManagement->updateModules();
+ } catch (\Exception $e) {
+ throw new \RuntimeException(sprintf('Refresh modules list fail with Exception : [%d] %s', $e->getCode(), $e->getMessage()));
+ }
+
+ if (method_exists($output, 'renderBlock')) {
+ $output->renderBlock([
+ '',
+ 'Modules list successfully refreshed',
+ ''
+ ],
+ 'bg=green;fg=black'
+ );
+ }
+ }
+}
diff --git a/core/lib/Thelia/Config/Resources/command.xml b/core/lib/Thelia/Config/Resources/command.xml
index 8b61f40e7..313904c40 100644
--- a/core/lib/Thelia/Config/Resources/command.xml
+++ b/core/lib/Thelia/Config/Resources/command.xml
@@ -11,6 +11,7 @@
+
diff --git a/core/lib/Thelia/Tests/Command/ModuleRefreshCommandTest.php b/core/lib/Thelia/Tests/Command/ModuleRefreshCommandTest.php
new file mode 100644
index 000000000..15fd15a38
--- /dev/null
+++ b/core/lib/Thelia/Tests/Command/ModuleRefreshCommandTest.php
@@ -0,0 +1,105 @@
+
+ *
+ * Date: 2014-06-06
+ * Time: 17:29
+ */
+class ModuleRefreshCommandTest extends PHPUnit_Framework_TestCase
+{
+ /**
+ * Test ModuleRefreshCommand
+ */
+ public function testModuleRefreshCommand()
+ {
+ $moduleManagement = new ModuleManagement;
+ $moduleManagement->updateModules();
+
+ $module = ModuleQuery::create()->filterByType(1)->orderByPosition(Criteria::DESC)->findOne();
+
+ if ($module !== null) {
+ $module->delete();
+
+ $application = new Application($this->getKernel());
+
+ $moduleRefresh = new ModuleRefreshCommand;
+ $moduleRefresh->setContainer($this->getContainer());
+
+ $application->add($moduleRefresh);
+
+ $command = $application->find('module:refresh');
+ $commandTester = new CommandTester($command);
+ $commandTester->execute([
+ 'command' => $command->getName()
+ ]);
+
+ $expected = $module;
+ $actual = ModuleQuery::create()->filterByType(1)->orderByPosition(Criteria::DESC)->findOne();
+
+ $this->assertEquals($expected->getCode(), $actual->getCode(), 'Last standard module code must be same after deleting this one and calling module:refresh');
+ $this->assertEquals($expected->getType(), $actual->getType(), 'Last standard module type must be same after deleting this one and calling module:refresh');
+ $this->assertEquals($expected->getFullNamespace(), $actual->getFullNamespace(), 'Last standard module namespace must be same after deleting this one and calling module:refresh');
+
+ // Restore activation status
+ $actual
+ ->setActivate($expected->getActivate())
+ ->save();
+
+ } else {
+ $this->markTestIncomplete(
+ 'This test cannot be complete without at least one standard module.'
+ );
+ }
+ }
+
+ /**
+ * Get HttpKernel mock
+ *
+ * @return Kernel Not really a Kernel but the mocked one
+ */
+ public function getKernel()
+ {
+ $kernel = $this->getMock('Symfony\\Component\\HttpKernel\\KernelInterface');
+
+ return $kernel;
+ }
+
+ /**
+ * Get new ContainerBuilder
+ *
+ * @return ContainerBuilder
+ */
+ public function getContainer()
+ {
+ $container = new ContainerBuilder;
+
+ return $container;
+ }
+}