public function testTokens() { $t = new ModerationTestsuite(); $t->loginAs($t->unprivilegedUser); $t->doTestEdit(); $t->fetchSpecial(); $entry = $t->new_entries[0]; $entry->fakeBlockLink(); # Non-readonly actions require a correct token $links = array($entry->approveLink, $entry->approveAllLink, $entry->rejectLink, $entry->rejectAllLink, $entry->blockLink, $entry->unblockLink); foreach ($links as $url) { $this->assertRegExp('/\\(sessionfailure-title\\)/', $t->noTokenTitle($url)); /* Double-check that nothing happened */ $t->fetchSpecial(); $this->assertCount(0, $t->new_entries); $this->assertCount(0, $t->deleted_entries); # Would the wrong token work? $this->assertRegExp('/\\(sessionfailure-title\\)/', $t->badTokenTitle($url)); /* Double-check that nothing happened */ $t->fetchSpecial(); $this->assertCount(0, $t->new_entries); $this->assertCount(0, $t->deleted_entries); } }