2016-01-19 15:30:55 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* #PHPHEADER_OECAPTCHA_LICENSE_INFORMATION#
|
|
|
|
*/
|
|
|
|
|
2017-11-10 13:36:09 +01:00
|
|
|
use OxidEsales\EshopCommunity\Core\DatabaseProvider;
|
|
|
|
|
2016-01-19 15:30:55 +01:00
|
|
|
require_once __DIR__ . '/../CaptchaTestCase.php';
|
|
|
|
|
|
|
|
class Unit_Core_oecaptchaEventsTest extends CaptchaTestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Set up the fixture.
|
|
|
|
*/
|
|
|
|
protected function setUp()
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
//Drop captcha table
|
2017-11-10 13:36:09 +01:00
|
|
|
DatabaseProvider::getDB()->execute("DROP TABLE IF EXISTS `oecaptcha`");
|
2016-01-19 15:30:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tear down the fixture.
|
|
|
|
*/
|
|
|
|
public function tearDown()
|
|
|
|
{
|
|
|
|
oeCaptchaEvents::addCaptchaTable();
|
|
|
|
|
|
|
|
parent::tearDown();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test onActivate event.
|
|
|
|
*/
|
|
|
|
public function testOnActivate()
|
|
|
|
{
|
|
|
|
oeCaptchaEvents::onActivate();
|
|
|
|
|
|
|
|
$oDbMetaDataHandler = oxNew('oxDbMetaDataHandler');
|
|
|
|
|
|
|
|
//If session is not available, table oecaptcha is where captcha information is stored
|
|
|
|
$this->assertTrue($oDbMetaDataHandler->tableExists('oecaptcha'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test onActivate event.
|
|
|
|
*/
|
|
|
|
public function testOnDeactivate()
|
|
|
|
{
|
|
|
|
oeCaptchaEvents::onDeactivate();
|
|
|
|
|
|
|
|
$oDbMetaDataHandler = oxNew('oxDbMetaDataHandler');
|
|
|
|
|
|
|
|
//If session is not available, table oecaptcha is where captcha information is stored
|
|
|
|
$this->assertFalse($oDbMetaDataHandler->tableExists('oecaptcha'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|