mirror of
https://github.com/e107inc/e107.git
synced 2025-08-22 06:03:27 +02:00
Issue #4356 Fixes a conflic with secureImage prefs. Added secureImage tests.
This commit is contained in:
111
e107_tests/tests/unit/secure_imageTest.php
Normal file
111
e107_tests/tests/unit/secure_imageTest.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
|
||||
class secure_imageTest extends \Codeception\Test\Unit
|
||||
{
|
||||
|
||||
/** @var secure_image */
|
||||
protected $si;
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
$this->si = e107::getSecureImg();
|
||||
}
|
||||
|
||||
catch(Exception $e)
|
||||
{
|
||||
$this->assertTrue(false, $e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function testCodeAndVerify()
|
||||
{
|
||||
$code = $this->si->create_code();
|
||||
|
||||
$this->si->renderImage();
|
||||
$this->si->renderInput();
|
||||
|
||||
$secret = $this->si->getSecret();
|
||||
|
||||
$result = $this->si->invalidCode($code, $secret);
|
||||
$this->assertFalse($result);
|
||||
|
||||
$code = $this->si->create_code(); // code above is destroyed upon successful match.
|
||||
$secret = $this->si->getSecret();
|
||||
$result = $this->si->verify_code($code, $secret);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$code = $this->si->create_code();
|
||||
$result = $this->si->invalidCode($code, 'bad code');
|
||||
$this->assertSame('Incorrect code entered.', $result);
|
||||
|
||||
|
||||
$result = $this->si->verify_code($code, 'bad code');
|
||||
$this->assertFalse($result);
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
public function testInvalidCode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderImage()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testCreate_code()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testHex2rgb()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRender()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderLabel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function test__construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testR_image()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testRenderInput()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testVerify_code()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testImageCreateTransparent()
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user