public function testMyAccountPageForUserWithoutWarnings(){ $this->setSessionUserNormal(); require dirname(__FILE__) . DIRECTORY_SEPARATOR . '../../src/myaccount.php'; $expectedPage = "<center><h3>My Account</h3></center> <table class=\"myaccount\"> <tr> <td colspan=4 class=\"header\">Edit User Information</td> </tr> <tr> <td class=\"centeredcellbold\">Username</td> <td colspan=3 class=\"centeredcell\">User</td> </tr> <tr> <td class=\"centeredcellbold\">Name</th> <td colspan=3 class=\"centeredcell\">Test User</td> </tr> <tr> <td class=\"centeredcellbold\">Change Password</td> <td class=\"centeredcellbold\">Current Password</td> <td class=\"centeredcellbold\">New Password</td> <td class=\"centeredcellbold\">Confirm Password</td> </tr> <tr> <form action=\"./index.php?pageid=savepassword\" method=\"POST\"><td class=\"centeredcellbold\"><input type=\"submit\" value=\"Save Password\"></td> <td class=\"centeredcell\"><input type=\"password\" name=\"curpass\"></td> <td class=\"centeredcell\"><input type=\"password\" name=\"newpass\"></th> <td class=\"centeredcell\"><input type=\"password\" name=\"confpass\"></td></form> </tr> <tr> <form action=\"./index.php?pageid=saveemail\" method=\"POST\"> <td colspan=1 class=\"centeredcellbold\">Email</th><td colspan=3 class=\"centeredcell\"><input type=\"text\" name=\"email\" size=30 value=\"".DBTestUtil::getTestEmail()."\"><input type=\"submit\" value=\"Save Email\"></td></form> </tr> <tr> <td colspan=1 class=\"centeredcellbold\">Warnings</th> <td class=\"centeredcellbold\" colspan=3><a href=\"./index.php?pageid=viewmywarnings\">1(3)</a></td> </tr> </table>"; $this->assertPageEquals($expectedPage, $pageData); }
public function testMakeReservationPageWithWarnedUser(){ $this->setSessionUserThreeWarnings(); $_GET['equipid'] = 1; $_GET['pageid'] = "reservation"; require dirname(__FILE__) . DIRECTORY_SEPARATOR . '../../src/reservation.php'; $expectedPage = "<center><h3><font color=\"#FF0000\">Error: You have recieved 3 or more warnings.</font></h3>To reserve equipment please contact an admin: <br><br>Test Admin -- ".DBTestUtil::getTestEmail()."<br /></center>"; $this->assertPageEquals($expectedPage, $pageData); }
private static function addUsers(){ // Admin // user_id = 1 doQuery("INSERT INTO ".getConfigVar('db_prefix')."_users SET username = '******', name = 'Test Admin', password = '******'TestPass1')."', email = '".DBTestUtil::getTestEmail()."', user_level = '".getConfigVar('admin_rank')."'"); // Moderator // user_id = 2 doQuery("INSERT INTO ".getConfigVar('db_prefix')."_users SET username = '******', name = 'Test Mod', password = '******'TestPass1')."', email = '".DBTestUtil::getTestEmail()."', user_level = '".getConfigVar('moderator_rank')."'"); // Normal User // user_id = 3 doQuery("INSERT INTO ".getConfigVar('db_prefix')."_users SET username = '******', name = 'Test User', password = '******'TestPass1')."', email = '".DBTestUtil::getTestEmail()."', user_level = '1'"); // Disabled // user_id = 4 doQuery("INSERT INTO ".getConfigVar('db_prefix')."_users SET username = '******', name = 'Disabled User', password = '******'TestPass1')."', email = '".DBTestUtil::getTestEmail()."', user_level = '0'"); // Too Many Active Warnings // user_id = 5 doQuery("INSERT INTO ".getConfigVar('db_prefix')."_users SET username = '******', name = 'Bad User', password = '******'TestPass1')."', email = '".DBTestUtil::getTestEmail()."', user_level = '1'"); }
public function testGetOurEquipForNormalUser(){ $this->setSessionUserNormal(); require dirname(__FILE__) . DIRECTORY_SEPARATOR . '../../src/ourequip.php'; $expectedPage = "<center><h3>Our Equipment</h3></center> <center><b><a href=\"#Category 1\">Category 1</a> - <a href=\"#Category 2\">Category 2</a></b></center> <h3>Category 1</h3> <table class=\"ourequip\"> <tr> <td width=\"40%\" class=\"header\" id=\"Category 1\">Equipment Name</th> <td width=\"15%\" class=\"header\">--</th> <td width=\"25%\" class=\"header\">Status</th> <td width=\"20%\" class=\"header\">--</th> </tr> <tr> <td class=\"centeredcell\">All Users1</td> <td class=\"centeredcell\"><a href=\"./index.php?pageid=moreinfo&equipid=1\">More Info</a></td> <td class=\"centeredcell\">Available</td> <td class=\"centeredcell\"><a href=\"./index.php?pageid=reservation&equipid=1\">Reserve</a></td> </tr> </table> <h3>Category 2</h3> <table class=\"ourequip\"> <tr> <td width=\"40%\" class=\"header\" id=\"Category 2\">Equipment Name</th> <td width=\"15%\" class=\"header\">--</th> <td width=\"25%\" class=\"header\">Status</th> <td width=\"20%\" class=\"header\">--</th> </tr> <tr> <td class=\"centeredcell\">All Users2</td> <td class=\"centeredcell\"><a href=\"./index.php?pageid=moreinfo&equipid=2\">More Info</a></td> <td class=\"centeredcell\">Available</td> <td class=\"centeredcell\"><a href=\"./index.php?pageid=reservation&equipid=2\">Reserve</a></td> </tr> <tr> <td class=\"centeredcell\">Check Out From</td> <td class=\"centeredcell\"><a href=\"./index.php?pageid=moreinfo&equipid=4\">More Info</a></td> <td class=\"centeredcell\" colspan=2>Checkout from<br><a href=\"mailto:".DBTestUtil::getTestEmail()."\">Test Mod</a></td> </tr> </table>"; $this->assertPageEquals($expectedPage, $pageData); }