checkPartTypeRundaily = new CheckPartTypeRundaily(); } public function testIsEnabled_enabledTomorrow() { global $setup; $setup['SetupBoardApproval'] = "yes"; $setup['EventDateStart'] = date("d.m.Y", strtotime("tomorrow")); $this->assertTrue($this->checkPartTypeRundaily->isEnabled()); } public function testIsEnabled_disabledYesterday() { global $setup; $setup['SetupBoardApproval'] = "yes"; $setup['EventDateStart'] = date("d.m.Y", strtotime("yesterday")); $this->assertFalse($this->checkPartTypeRundaily->isEnabled()); } public function testIsEnabled_disabledToday() { global $setup; $setup['SetupBoardApproval'] = "yes"; $setup['EventDateStart'] = date("d.m.Y"); $this->assertFalse($this->checkPartTypeRundaily->isEnabled()); } public function testIsEnabled_disabledNoBoardApproval() { global $setup; $setup['SetupBoardApproval'] = "no"; $setup['EventDateStart'] = date("d.m.Y", strtotime("tomorrow")); $this->assertFalse($this->checkPartTypeRundaily->isEnabled()); } public function testRun_duplicateParticipanttypeAndOrder() { $aachen = $this->insertBodyAachen(); $this->insertApplication(1, $aachen['bodycode'], "delegate", 1); $this->insertApplication(2, $aachen['bodycode'], "delegate", 1); $this->checkPartTypeRundaily->run(); $application = $this->getDB()->fetchRow("applications", 2); $this->assertEquals("-", $application['participanttype']); $this->assertNull($application['participantorder']); $this->assertContains("duplicate participant type/order for Firstname1 Lastname1 and Firstname2 Lastname2. Last one will be removed.", implode("\n", $this->checkPartTypeRundaily->getMessages())); } public function testRun_invalidParticipanttypeAndOrder() { $aachen = $this->insertBodyAachen(); $this->insertApplication(1, $aachen['bodycode'], "delegate", 4); $this->checkPartTypeRundaily->run(); $application = $this->getDB()->fetchRow("applications", 1); $this->assertEquals("-", $application['participanttype']); $this->assertNull($application['participantorder']); $this->assertContains("invalid participant type/order for Firstname1 Lastname1. Invalid values: ParticipantType=delegate; ParticipantOrder=4", implode("\n", $this->checkPartTypeRundaily->getMessages())); } } ?>