Skip to content
Snippets Groups Projects
Commit b989733f authored by Ghislain Loas's avatar Ghislain Loas
Browse files

dev #13296 fix formation getAnnee

parent b9286e5e
Branches
Tags
4 merge requests!258Dev/13872 Orphee Allow Hold Available Items,!180Master,!104Sprint3 Dev #13296 Formation Widget,!98Sprint3 Dev #13296 Formation Widget
......@@ -56,7 +56,7 @@ class Class_Formation extends Storm_Model_Abstract {
public function getAnnee() {
if ($this->hasSessions())
return array_first($this->getSessions())->getAnnee();
return self::getTimeSource()->date('Y');
return date('Y', self::getTimeSource()->time());
}
......
......@@ -21,9 +21,12 @@
class FormationJavaWithNoSessionTest extends Storm_Test_ModelTestCase {
public function setUp() {
$this->_learning_java = Class_Formation::getLoader()
->newInstanceWithId(99999)
->setLibelle('Learning Java');
Class_Formation::setTimeSource(new TimeSourceForTest('2014-05-01 14:00:00'));
$this->_learning_java = $this->fixture('Class_Formation',
['id' => 999,
'libelle' => 'Learning Java']);
}
/** @test */
......@@ -39,7 +42,7 @@ class FormationJavaWithNoSessionTest extends Storm_Test_ModelTestCase {
/** @test */
function getAnneeShouldReturnCurrentYear() {
$this->assertEquals(date('Y'), $this->_learning_java->getAnnee());
$this->assertEquals('2014', $this->_learning_java->getAnnee());
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment