contactPwdRundaily = new ContactPwdRundaily(); } public function testIsEnabled_enabledTomorrow() { global $setup; $setup['EventDateStart'] = date("d.m.Y", strtotime("tomorrow")); $this->assertTrue($this->contactPwdRundaily->isEnabled()); } public function testIsEnabled_disabledYesterday() { global $setup; $setup['EventDateStart'] = date("d.m.Y", strtotime("yesterday")); $this->assertFalse($this->contactPwdRundaily->isEnabled()); } public function testIsEnabled_disabledToday() { global $setup; $setup['EventDateStart'] = date("d.m.Y"); $this->assertFalse($this->contactPwdRundaily->isEnabled()); } public function testIsEnabled_disabledNoDate() { global $setup; $setup['EventDateStart'] = ""; $this->assertFalse($this->contactPwdRundaily->isEnabled()); } public function testRun_noAnonymousIsOnlyContacts() { global $setup; $setup['EventDatePartTypeFix'] = date("d.m.Y", strtotime("tomorrow")); $setup['EventDateEnd'] = date("d.m.Y", strtotime("+1 month")); $setup['PromoteAnonymousApplication'] = false; $aachen = $this->insertBodyAachen(); $this->insertApplication(1, $aachen['bodycode'], "delegate", 1); $glasgow = $this->insertBodyContactGlasgow(); $this->insertApplication(2, $glasgow['bodycode'], "observer", 1); $this->contactPwdRundaily->run(); $this->assertContains("Created new password for body " . $glasgow['bodyname'] . " and sent it by mail", implode("\n", $this->contactPwdRundaily->getMessages())); $this->assertNotContains($aachen['bodyname'], implode("\n", $this->contactPwdRundaily->getMessages())); } public function testRun_anonymousIsLocalsAndContacts() { global $setup; $setup['EventDatePartTypeFix'] = date("d.m.Y", strtotime("tomorrow")); $setup['EventDateEnd'] = date("d.m.Y", strtotime("+1 month")); $setup['PromoteAnonymousApplication'] = true; $aachen = $this->insertBodyAachen(); $this->insertApplication(1, $aachen['bodycode'], "delegate", 1); $glasgow = $this->insertBodyContactGlasgow(); $this->insertApplication(2, $glasgow['bodycode'], "observer", 1); $this->contactPwdRundaily->run(); $this->assertContains("Created new password for body " . $glasgow['bodyname'] . " and sent it by mail", implode("\n", $this->contactPwdRundaily->getMessages())); $this->assertContains("Created new password for body " . $aachen['bodyname'] . " and sent it by mail", implode("\n", $this->contactPwdRundaily->getMessages())); } public function testRun_sendReminderMemberlistToLocalsAndContacts() { global $setup; $setup['EventDatePartTypeFix'] = date("d.m.Y", strtotime("tomorrow")); $setup['EventDateEnd'] = date("d.m.Y", strtotime("+1 month")); $setup['PromoteAnonymousApplication'] = true; $setup['UploadMembersList'] = true; $setup['SendPasswordForMemListDate'] = date("d.m.Y", strtotime("yesterday")); $aachen = $this->insertBodyAachen(); $glasgow = $this->insertBodyContactGlasgow(); $itwg = $this->insertBodyITWG(); $this->contactPwdRundaily->run(); $this->assertContains("Created new password for body " . $glasgow['bodyname'] . " and sent it by mail", implode("\n", $this->contactPwdRundaily->getMessages())); $this->assertContains("Created new password for body " . $aachen['bodyname'] . " and sent it by mail", implode("\n", $this->contactPwdRundaily->getMessages())); $this->assertNotContains($itwg['bodyname'], implode("\n", $this->contactPwdRundaily->getMessages())); } public function testRun_sendNoReminderMemberlistWhenUploadDisabled() { global $setup; $setup['EventDatePartTypeFix'] = date("d.m.Y", strtotime("tomorrow")); $setup['EventDateEnd'] = date("d.m.Y", strtotime("+1 month")); $setup['PromoteAnonymousApplication'] = true; $setup['UploadMembersList'] = false; $setup['SendPasswordForMemListDate'] = date("d.m.Y", strtotime("yesterday")); $aachen = $this->insertBodyAachen(); $glasgow = $this->insertBodyContactGlasgow(); $itwg = $this->insertBodyITWG(); $this->contactPwdRundaily->run(); $this->assertNotContains($glasgow['bodyname'], implode("\n", $this->contactPwdRundaily->getMessages())); $this->assertNotContains($aachen['bodyname'], implode("\n", $this->contactPwdRundaily->getMessages())); $this->assertNotContains($itwg['bodyname'], implode("\n", $this->contactPwdRundaily->getMessages())); } public function testRun_sendNoReminderMemberlistWhenReminderIsTomorrow() { global $setup; $setup['EventDatePartTypeFix'] = date("d.m.Y", strtotime("tomorrow")); $setup['EventDateEnd'] = date("d.m.Y", strtotime("+1 month")); $setup['PromoteAnonymousApplication'] = true; $setup['UploadMembersList'] = true; $setup['SendPasswordForMemListDate'] = date("d.m.Y", strtotime("tomorrow")); $aachen = $this->insertBodyAachen(); $glasgow = $this->insertBodyContactGlasgow(); $itwg = $this->insertBodyITWG(); $this->contactPwdRundaily->run(); $this->assertNotContains($glasgow['bodyname'], implode("\n", $this->contactPwdRundaily->getMessages())); $this->assertNotContains($aachen['bodyname'], implode("\n", $this->contactPwdRundaily->getMessages())); $this->assertNotContains($itwg['bodyname'], implode("\n", $this->contactPwdRundaily->getMessages())); } public function testRun_sendNoReminderMemberlistWhenAlreadyHasPassword() { global $setup; $setup['EventDatePartTypeFix'] = date("d.m.Y", strtotime("tomorrow")); $setup['EventDateEnd'] = date("d.m.Y", strtotime("+1 month")); $setup['PromoteAnonymousApplication'] = true; $setup['UploadMembersList'] = true; $setup['SendPasswordForMemListDate'] = date("d.m.Y", strtotime("yesterday")); $aachen = $this->getBodyAachen(); $aachen['password'] = md5("password"); $this->getDB()->insert("ab_bodies", $aachen); $glasgow = $this->getBodyContactGlasgow(); $glasgow['password'] = md5("password"); $this->getDB()->insert("ab_bodies", $glasgow); $this->contactPwdRundaily->run(); $this->assertNotContains($glasgow['bodyname'], implode("\n", $this->contactPwdRundaily->getMessages())); $this->assertNotContains($aachen['bodyname'], implode("\n", $this->contactPwdRundaily->getMessages())); } } ?>