1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 14:46:56 +02:00

basic class2 tests added for common functions.

This commit is contained in:
Cameron
2019-02-19 11:26:51 -08:00
parent 010784d371
commit 2e6fe30ae6

79
tests/unit/class2Test.php Normal file
View File

@@ -0,0 +1,79 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2019 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
class class2Test extends \Codeception\Test\Unit
{
/** @var ${TESTED_NAME} */
protected $ep;
protected function _before()
{
/*try
{
$this->ep = $this->make('${TESTED_NAME}');
} catch(Exception $e)
{
$this->assertTrue(false, "Couldn't load ${TESTED_NAME} object");
}*/
}
function testGetPerms()
{
$result = getperms('N', '0');
$this->assertTrue($result);
$result = getperms('N', '0.');
$this->assertTrue($result);
$result = getperms('U1|U2', '0.');
$this->assertTrue($result);
}
function testCheckClass()
{
$result = check_class(0, "253,254,250,251,0");
$this->assertTrue($result);
$result = check_class(254, "253,254,250,251,0");
$this->assertTrue($result);
}
function testCheckEmail()
{
$result = check_email("test@somewhere.com"); // good email.
$this->assertEquals('test@somewhere.com', $result);
$result = check_email("test@somewherecom"); // Missing .
$this->assertFalse($result);
$result = check_email("test@somewhere.technology"); // New TLDs
$this->assertEquals('test@somewhere.technology',$result);
}
}