diff --git a/e107_handlers/iphandler_class.php b/e107_handlers/iphandler_class.php index a14a5a206..e31bbf148 100644 --- a/e107_handlers/iphandler_class.php +++ b/e107_handlers/iphandler_class.php @@ -1278,6 +1278,7 @@ class banlistManager public function __construct() { + e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_banlist.php"); $this->ourConfigDir = e107::getIPHandler()->getConfigDir(); $this->banTypes = array( // Used in Admin-ui. '-1' => BANLAN_101, // manual diff --git a/e107_tests/tests/unit/eIPHandlerTest.php b/e107_tests/tests/unit/eIPHandlerTest.php new file mode 100644 index 000000000..0f4ea4d2a --- /dev/null +++ b/e107_tests/tests/unit/eIPHandlerTest.php @@ -0,0 +1,162 @@ +ip = $this->make('eIPHandler'); + } catch(Exception $e) + { + $this->assertTrue(false, "Couldn't load eIPHandler object"); + } + + $this->__construct(); + } + +/* public function testMakeEmailQuery() + { + + } + + public function testGet_host_name() + { + + } + + public function testSetIP() + { + + } + + public function testIpDecode() + { + + } + + public function testWhatIsThis() + { + + } + + public function testIp6AddWildcards() + { + + } + + public function testIsUserLogged() + { + + } + + public function testCheckFilePerms() + { + + } + + public function test__construct() + { + + } + + public function testCheckBan() + { + + } + + public function testPermsToString() + { + + } + + public function testMakeDomainQuery() + { + + }*/ + + public function testAdd_ban() + { + // $bantype = 1 for manual, 2 for flooding, 4 for multiple logins + + $banDurations = array( + '0' => 0, + '-1' => 0, // manually added ban + '-2' => 0, // flood + '-3' => 8, // hits + '-4' => 10, // multi-login + '-5' => 0, // imported + '-6' => 0, // banned user + '-8' => 0 // unknown + ); + + define('LAN_SETSAVED', "Saved"); // for preferences. + + //set ban duration pref. + e107::getConfig()->set('ban_durations',$banDurations)->save(false,true, false); + + $result = $this->ip->add_ban(2,"unit test generated ban", '123.123.123.123', 0,); + $this->assertTrue($result); + + + } +/* + public function testGetIP() + { + + } + + public function testGetConfigDir() + { + + } + + public function testRegenerateFiles() + { + + } + + public function testBan() + { + + } + + public function testIsAddressRoutable() + { + + } + + public function testIpEncode() + { + + } + + public function testDebug() + { + + } + + public function testGetUserToken() + { + + } + + */ + + + }