public function setUp() { parent::setUp(); Restorator::restore(); Helper::setupUsers([['login' => self::RootLogin, 'password' => self::Password, 'rights' => [\CMSAuth::AdministratorRoleName => true]]]); \UsersLogin::login(self::RootLogin, self::Password); }
public function setUp() { parent::setUp(); Restorator::restore(); Helper::setupUsers(array(array('login' => self::Login, 'password' => self::Password, 'email' => self::Email))); $this->configureLoginAttempts(5, 10); $this->cleanUpSchemes(); RegistrationAcceptedEmail::install(); RegistrationConfirmationEmail::install(); }
public static function run() { TestsHelper::dbFixture(ACL_TABLE, array()); Restorator::restore(); TestsHelper::dbFixture(USERS_TABLE, array(array('login' => self::loginFixture, 'password' => passwordColumn::hash(self::passwordFixture)))); // ACL::create(self::rightFixture); // $user = UserAccount::getByLogin(self::loginFixture); ACL::grant(self::rightFixture, $user->obj_rights->getEntity()); }
public function setUp() { parent::setUp(); Helper::dbFixture(Job::TableName, array()); $this->setRunnerTimeout(0); Restorator::restore(); Helper::setupUsers([['login' => self::Login, 'password' => self::Password], ['login' => 'guest', 'password' => self::Password]]); $user = \UserAccount::getByLogin(self::Login); \ACL::create(\CMSAuth::SystemAdministratorRoleName); \ACL::grant(\CMSAuth::SystemAdministratorRoleName, $user->rights->getEntity()); \UsersLogin::forceLogin($user); TestAction::setUp(); }
use Faid\DBSimple; use Extasy\tests\Helper as TestsHelper; use UserAccount; use ACL; use Extasy\Audit\Api\ApiOperation; use Extasy\Audit\Record; use Extasy\Audit\Log; use Extasy\tests\system_register\Restorator; use Extasy\Columns\Password as passwordColumn; $register = new \SystemRegister('/System/'); try { $register->delete('Audit'); } catch (\Exception $e) { } Restorator::restore(); \SystemRegisterSample::createCache(); TestsHelper::dbFixture(ACL_TABLE, array()); ACL::create(ApiOperation::RightName); // user record TestsHelper::dbFixture(USERS_TABLE, array(array('login' => 'login', 'password' => passwordColumn::hash('testtest')), array('login' => 'guest', 'password' => passwordColumn::hash('testtest')))); // grant user permission $user = UserAccount::getByLogin('login'); ACL::grant(ApiOperation::RightName, $user->obj_rights->getEntity()); \UsersLogin::login('login', 'testtest'); // base logs TestsHelper::dbFixture(Log::getTableName(), array(array('name' => 'Log1', 'critical' => 0, 'enable_logging' => 1), array('name' => 'Log2', 'critical' => 1, 'enable_logging' => 1))); // base records // - [different by user_id] // - [different by date] // - [different by content]
<?php use Extasy\tests\Helper; use Extasy\tests\system_register\Restorator; Restorator::restorePath('/System/', array('Sitemap' => array('visible' => 0, 'sitemap.xml.disable' => 1, 'sitemap.xml' => 1))); SystemRegisterSample::createCache(); class Test_Document extends \Extasy\Model\Model { const ModelName = 'Test_Document'; const TableName = 'sitemap_test_document'; public static function getFieldsInfo() { return array('table' => self::TableName, 'fields' => array('id' => '\\Extasy\\Columns\\Index', 'name' => '\\Extasy\\Columns\\Input')); } }
public function tearDown() { SystemRegisterSample::clearCache(); \Extasy\tests\system_register\Restorator::restore(); }
protected function clearSystemRegister() { \Extasy\tests\system_register\Restorator::restore(); }
<?php use Extasy\tests\Helper; \Extasy\tests\system_register\Restorator::restore(); require_once CLASS_PATH . 'dumper/dumper.class.php'; $sql = <<<SQL \tDROP TABLE IF EXISTS acl_actions ; \tDROP TABLE IF EXISTS acl_grants; \tCREATE TABLE acl_actions ( \t\t`id` INT NOT NULL auto_increment, \t\t`name` varchar(40) not null COMMENT 'Имя события', \t\t`title` varchar(80) null COMMENT 'Подпись к событию', \t\t`parentId` int not null, \t\t`fullPath` varchar(255) not null, \t\tPRIMARY KEY (`id`), \t\tindex `searchParent` (`parentId`), \t\tindex `searchChild` (`parentId`,`name`), \t\tindex `searchPath` (`fullPath`) \t); \tCREATE TABLE acl_grants ( \t\t`actionId` int not null COMMENT 'Индекс события', \t\t`entity` varchar(80) not null COMMENT 'Имя объекта', \t\t unique `search` (`actionId`,`entity`), \t\t index search_by_entity (`entity`) \t); SQL; $dumper = new CDumper(); $dumper->import($sql);