diff --git a/bin/console b/bin/console
index 541d0f95ac..d45c1bff3b 100755
--- a/bin/console
+++ b/bin/console
@@ -49,6 +49,7 @@ use Alchemy\Phrasea\SearchEngine\SearchEngineInterface;
require_once __DIR__ . '/../lib/autoload.php';
+$version = new Version();
$cli = new CLI("
_____ _ _ _____ _____ ______ _ _ ______ _______
| __ \| | | | __ \ /\ / ____| ____| /\ | \ | | ____|__ __|
@@ -65,7 +66,7 @@ $cli = new CLI("
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `about:license' for details.\n\n"
- . ' KONSOLE KOMMANDER', Version::getName() . ' ' . Version::getNumber());
+ . ' KONSOLE KOMMANDER', $version->getName() . ' ' . $version->getNumber());
if (!$cli['phraseanet.configuration-tester']->isInstalled()) {
throw new \RuntimeException('Phraseanet is not installed, use setup command instead');
diff --git a/bin/developer b/bin/developer
index f9f7831b0b..9dd7c792f5 100755
--- a/bin/developer
+++ b/bin/developer
@@ -55,6 +55,7 @@ use Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand;
require_once __DIR__ . '/../lib/autoload.php';
+$version = new Version();
$cli = new CLI("
___ ___ _ _ ___ __ __ ___ ___ ___ ____ __ __ __ ___
( \( _)( )( )( _)( ) / \( ,\( _)( ,) (_ _)/ \ / \( ) / __)
@@ -65,7 +66,7 @@ $cli = new CLI("
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `about:license' for details.\n\n"
- . ' Phraseanet Developer Tools ', Version::getName() . ' ' . Version::getNumber());
+ . ' Phraseanet Developer Tools ', $version->getName() . ' ' . $version->getNumber());
if ($cli['configuration.store']->isSetup()) {
$helpers = [
diff --git a/bin/setup b/bin/setup
index 18cd6933d4..cd5a79493d 100755
--- a/bin/setup
+++ b/bin/setup
@@ -27,6 +27,7 @@ use Alchemy\Phrasea\Core\CLIProvider\DoctrineMigrationServiceProvider;
require_once __DIR__ . '/../vendor/autoload.php';
+$version = new Version();
$app = new CLI("
_____ _ _ _____ _____ ______ _ _ ______ _______
| __ \| | | | __ \ /\ / ____| ____| /\ | \ | | ____|__ __|
@@ -45,7 +46,7 @@ $app = new CLI("
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `about:license' for details.\n\n"
- . ' SETUP', Version::getName() . ' ' . Version::getNumber());
+ . ' SETUP', $version->getName() . ' ' . $version->getNumber());
$app->register(new DoctrineMigrationServiceProvider());
diff --git a/lib/Alchemy/Phrasea/Command/Developer/IniReset.php b/lib/Alchemy/Phrasea/Command/Developer/IniReset.php
index 73317127a3..b75f1fe194 100644
--- a/lib/Alchemy/Phrasea/Command/Developer/IniReset.php
+++ b/lib/Alchemy/Phrasea/Command/Developer/IniReset.php
@@ -209,10 +209,11 @@ class IniReset extends Command
}
if ($input->getOption('run-patches') || false === $this->container['phraseanet.configuration']->isUpToDate()) {
+ $version = new Version();
if ($input->getOption('run-patches')) {
- $output->write(sprintf('Upgrading... from version 3.1.21 to %s', Version::getNumber()), true);
+ $output->write(sprintf('Upgrading... from version 3.1.21 to %s', $version->getNumber()), true);
} else {
- $output->write(sprintf('Upgrading... from version %s to %s', $this->app['phraseanet.appbox']->get_version(), Version::getNumber()), true);
+ $output->write(sprintf('Upgrading... from version %s to %s', $this->app['phraseanet.appbox']->get_version(), $version->getNumber()), true);
}
$cmd = 'php ' . __DIR__ . '/../../../../../bin/setup system:upgrade -y -f -v';
diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1.php b/lib/Alchemy/Phrasea/Controller/Api/V1.php
index e4ee6e2024..fe463d6cf5 100644
--- a/lib/Alchemy/Phrasea/Controller/Api/V1.php
+++ b/lib/Alchemy/Phrasea/Controller/Api/V1.php
@@ -13,7 +13,6 @@ namespace Alchemy\Phrasea\Controller\Api;
use Alchemy\Phrasea\Authentication\Context;
use Alchemy\Phrasea\Border\Attribute\Status;
-use Alchemy\Phrasea\Border\Checker\CheckerInterface;
use Alchemy\Phrasea\Border\File;
use Alchemy\Phrasea\Border\Manager as BorderManager;
use Alchemy\Phrasea\Border\Manager;
diff --git a/lib/Alchemy/Phrasea/Core/Version.php b/lib/Alchemy/Phrasea/Core/Version.php
index e3c38e719a..ab21c70d2e 100644
--- a/lib/Alchemy/Phrasea/Core/Version.php
+++ b/lib/Alchemy/Phrasea/Core/Version.php
@@ -13,16 +13,16 @@ namespace Alchemy\Phrasea\Core;
class Version
{
- protected static $number = '3.9.0-alpha.20';
- protected static $name = 'Herrerasaurus';
+ private $number = '3.9.0-alpha.20';
+ private $name = 'Herrerasaurus';
- public static function getNumber()
+ public function getNumber()
{
- return static::$number;
+ return $this->number;
}
- public static function getName()
+ public function getName()
{
- return static::$name;
+ return $this->name;
}
}
diff --git a/lib/Alchemy/Phrasea/TaskManager/Job/WebhookJob.php b/lib/Alchemy/Phrasea/TaskManager/Job/WebhookJob.php
index e76d0a1aa2..04127496bd 100644
--- a/lib/Alchemy/Phrasea/TaskManager/Job/WebhookJob.php
+++ b/lib/Alchemy/Phrasea/TaskManager/Job/WebhookJob.php
@@ -38,7 +38,8 @@ class WebhookJob extends AbstractJob
parent::__construct($dispatcher, $logger, $translator);
$this->httpClient = $httpClient ?: new GuzzleClient();
- $this->httpClient->setUserAgent(sprintf('Phraseanet/%s (%s)', Version::getNumber(), Version::getName()));
+ $version = new Version();
+ $this->httpClient->setUserAgent(sprintf('Phraseanet/%s (%s)', $version->getNumber(), $version->getName()));
}
/**
diff --git a/lib/classes/module/console/systemUpgrade.php b/lib/classes/module/console/systemUpgrade.php
index 48b8641e78..93a4c5ae4e 100644
--- a/lib/classes/module/console/systemUpgrade.php
+++ b/lib/classes/module/console/systemUpgrade.php
@@ -60,7 +60,8 @@ class module_console_systemUpgrade extends Command
}
if ($continue == 'y') {
- $output->write(sprintf('Upgrading... from version %s to %s', $this->container['phraseanet.appbox']->get_version(), Version::getNumber()), true);
+ $version = new Version();
+ $output->write(sprintf('Upgrading... from version %s to %s', $this->container['phraseanet.appbox']->get_version(), $version->getNumber()), true);
try {
$upgrader = new Setup_Upgrade($this->container, $input->getOption('force'));
diff --git a/tests/Alchemy/Tests/Phrasea/Core/VersionTest.php b/tests/Alchemy/Tests/Phrasea/Core/VersionTest.php
index f02a274386..f9c7b1fe07 100644
--- a/tests/Alchemy/Tests/Phrasea/Core/VersionTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Core/VersionTest.php
@@ -4,18 +4,20 @@ namespace Alchemy\Tests\Phrasea\Core;
use Alchemy\Phrasea\Core\Version;
-class VersionTest extends \PhraseanetTestCase
+class VersionTest extends \PHPUnit_Framework_TestCase
{
public function testGetNumber()
{
- $this->assertTrue(is_string(Version::getNumber()));
- $this->assertRegExp('/[\d]{1}\.[\d]{1,2}\.[\d]{1,2}/', Version::getNumber());
+ $version = new Version();
+ $this->assertTrue(is_string($version->getNumber()));
+ $this->assertRegExp('/[\d]{1}\.[\d]{1,2}\.[\d]{1,2}/', $version->getNumber());
}
public function testGetName()
{
- $this->assertTrue(is_string(Version::getName()));
- $this->assertTrue(strlen(Version::getName()) > 3);
+ $version = new Version();
+ $this->assertTrue(is_string($version->getName()));
+ $this->assertTrue(strlen($version->getName()) > 3);
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Setup/ConfigurationTesterTest.php b/tests/Alchemy/Tests/Phrasea/Setup/ConfigurationTesterTest.php
index a8fde75fc7..18853cabe7 100644
--- a/tests/Alchemy/Tests/Phrasea/Setup/ConfigurationTesterTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Setup/ConfigurationTesterTest.php
@@ -90,10 +90,8 @@ class ConfigurationTesterTest extends AbstractSetupTester
->disableOriginalConstructor()
->getMock();
- /**
- * Must return version + 1
- */
- $app['phraseanet.version']::staticExpects($this->any())
+ // Must return version + 1
+ $app['phraseanet.version']->expects($this->any())
->method('getNumber')
->will($this->returnValue('3.10'));