1
0
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:
Cameron
2021-02-02 19:18:44 -08:00
parent d1f997ee2c
commit 4b6d23dbf6
7 changed files with 220 additions and 92 deletions

View 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()
{
}
*/
}