|
|
@@ -42,7 +42,8 @@ class OnParametersChangeTest extends TestCase
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- public function testValidate() {
|
|
|
+ public function testValidate(): void
|
|
|
+ {
|
|
|
$context = $this->getMockBuilder(OnChangeContext::class)->disableOriginalConstructor()->getMock();
|
|
|
|
|
|
// 1. Is CMF and site web enabled ; 2. Is not CMF and site web disabled ; 3. Is not CMF and site web enabled
|
|
|
@@ -57,7 +58,8 @@ class OnParametersChangeTest extends TestCase
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function testValidateInvalid() {
|
|
|
+ public function testValidateInvalid(): void
|
|
|
+ {
|
|
|
$parameters = $this->getMockBuilder(Parameters::class)->disableOriginalConstructor()->getMock();
|
|
|
$context = $this->getMockBuilder(OnChangeContext::class)->disableOriginalConstructor()->getMock();
|
|
|
|
|
|
@@ -71,7 +73,8 @@ class OnParametersChangeTest extends TestCase
|
|
|
} catch (\RuntimeException) {}
|
|
|
}
|
|
|
|
|
|
- public function testBeforeChange() {
|
|
|
+ public function testBeforeChange(): void
|
|
|
+ {
|
|
|
$onParametersChange = $this
|
|
|
->getMockBuilder(OnParametersChange::class)
|
|
|
->onlyMethods(['onAdvancedEducationNotationTypeChange', 'onMusicalDateChange'])
|
|
|
@@ -110,7 +113,8 @@ class OnParametersChangeTest extends TestCase
|
|
|
$onParametersChange->beforeChange($parameters, $context);
|
|
|
}
|
|
|
|
|
|
- public function testOnChangeNoChange() {
|
|
|
+ public function testOnChangeNoChange(): void
|
|
|
+ {
|
|
|
$this->messageBus->expects($this->never())->method('dispatch');
|
|
|
|
|
|
$previousParameters = $this->getMockBuilder(Parameters::class)->disableOriginalConstructor()->getMock();
|
|
|
@@ -131,7 +135,8 @@ class OnParametersChangeTest extends TestCase
|
|
|
$this->onParametersChange->onChange($parameters, $context);
|
|
|
}
|
|
|
|
|
|
- public function testOnChangeAverageChanged() {
|
|
|
+ public function testOnChangeAverageChanged(): void
|
|
|
+ {
|
|
|
$this->messageBus
|
|
|
->expects(self::once())
|
|
|
->method('dispatch')
|
|
|
@@ -156,7 +161,8 @@ class OnParametersChangeTest extends TestCase
|
|
|
$this->onParametersChange->onChange($parameters, $context);
|
|
|
}
|
|
|
|
|
|
- public function testOnChangeCustomDomainChanged() {
|
|
|
+ public function testOnChangeCustomDomainChanged(): void
|
|
|
+ {
|
|
|
$this->messageBus
|
|
|
->expects(self::once())
|
|
|
->method('dispatch')
|
|
|
@@ -185,7 +191,8 @@ class OnParametersChangeTest extends TestCase
|
|
|
$this->onParametersChange->onChange($parameters, $context);
|
|
|
}
|
|
|
|
|
|
- public function testOnChangeWebsiteDisabled() {
|
|
|
+ public function testOnChangeWebsiteDisabled(): void
|
|
|
+ {
|
|
|
$this->messageBus
|
|
|
->expects(self::once())
|
|
|
->method('dispatch')
|
|
|
@@ -214,7 +221,7 @@ class OnParametersChangeTest extends TestCase
|
|
|
$this->onParametersChange->onChange($parameters, $context);
|
|
|
}
|
|
|
|
|
|
- public function testOnChangeWebsiteReenabled(): void
|
|
|
+ public function testOnChangeWebsiteEnabled(): void
|
|
|
{
|
|
|
$this->messageBus
|
|
|
->expects(self::exactly(2))
|
|
|
@@ -254,7 +261,8 @@ class OnParametersChangeTest extends TestCase
|
|
|
/**
|
|
|
* @see OnParametersChange::onAdvancedEducationNotationTypeChange()
|
|
|
*/
|
|
|
- public function testOnAdvancedEducationNotationTypeByTeachersChange(){
|
|
|
+ public function testOnAdvancedEducationNotationTypeByTeachersChange(): void
|
|
|
+ {
|
|
|
$educationNotationConfig = new EducationNotationConfig();
|
|
|
$educationCurriculum = new EducationCurriculum();
|
|
|
$educationNotationConfig->addEducationCurriculum($educationCurriculum);
|
|
|
@@ -273,7 +281,8 @@ class OnParametersChangeTest extends TestCase
|
|
|
/**
|
|
|
* @see OnParametersChange::onAdvancedEducationNotationTypeChange()
|
|
|
*/
|
|
|
- public function testOnAdvancedEducationNotationTypeByEducationChange(){
|
|
|
+ public function testOnAdvancedEducationNotationTypeByEducationChange(): void
|
|
|
+ {
|
|
|
$educationNotationConfig = new EducationNotationConfig();
|
|
|
$teacher = new Access();
|
|
|
$educationNotationConfig->addTeacher($teacher);
|
|
|
@@ -294,11 +303,13 @@ class OnParametersChangeTest extends TestCase
|
|
|
* @throws \Exception
|
|
|
* @see OnParametersChange::onMusicalDateChange()
|
|
|
*/
|
|
|
- public function testOnMusicalDateChange(){
|
|
|
- $organization = new Organization();
|
|
|
+ public function testOnMusicalDateChange(): void
|
|
|
+ {
|
|
|
$this->parameters->setMusicalDate(new \DateTime('2022-09-01'));
|
|
|
- $organization->setParameters($this->parameters);
|
|
|
|
|
|
+ $organization = new Organization();
|
|
|
+ $this->parameters->setOrganization($organization);
|
|
|
+ $organization->setParameters($this->parameters);
|
|
|
|
|
|
$course = new Course();
|
|
|
$course->setStartYear(2021);
|
|
|
@@ -310,7 +321,7 @@ class OnParametersChangeTest extends TestCase
|
|
|
->willReturn([$course])
|
|
|
;
|
|
|
|
|
|
- $this->onParametersChange->onMusicalDateChange($organization, new \DateTime('2022-09-05'));
|
|
|
+ $this->onParametersChange->onMusicalDateChange($this->parameters, new \DateTime('2022-09-05'));
|
|
|
|
|
|
$this->assertEquals(2022, $course->getStartYear());
|
|
|
$this->assertEquals(2023, $course->getEndYear());
|