mirror of
https://github.com/e107inc/e107.git
synced 2025-08-07 07:06:30 +02:00
basic class2 tests added for common functions.
This commit is contained in:
79
tests/unit/class2Test.php
Normal file
79
tests/unit/class2Test.php
Normal 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user