/** * Constructor. * * Generates dynamic records. * * @return void */ public function __construct() { $this->records[] = ['id' => 2, 'task' => 'Example', 'data' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.', 'not_before' => '2014-12-19 17:12:30', 'fetched' => '2014-12-19 17:12:30', 'completed' => date('Y-m-d H:i:s', strtotime('+1 minute')), 'failed_count' => 1, 'failure_message' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.', 'worker_key' => 'Lorem ipsum dolor sit amet', 'created' => '2014-12-19 17:12:30']; $this->records[] = ['id' => 3, 'task' => 'Example', 'data' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.', 'not_before' => '2014-12-19 17:12:30', 'fetched' => '2014-12-19 17:12:30', 'completed' => date('Y-m-d H:i:s', strtotime('-15 minute')), 'failed_count' => 1, 'failure_message' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.', 'worker_key' => 'Lorem ipsum dolor sit amet', 'created' => '2014-12-19 17:12:30']; $this->records[] = ['id' => 4, 'task' => 'Example', 'data' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.', 'not_before' => '2014-12-19 17:12:30', 'fetched' => '2014-12-19 17:12:30', 'completed' => date('Y-m-d H:i:s', strtotime('-5 minute')), 'failed_count' => 1, 'failure_message' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.', 'worker_key' => 'Lorem ipsum dolor sit amet', 'created' => '2014-12-19 17:12:30']; parent::__construct(); }
public function __construct(&$db) { parent::__construct($db); $config_dump = <<<EOT --- use_autoreload: "0" reverse_mode: "0" autoreload: "60" prefetch_num: "2" limit_subs: "100" use_pinsaver: "1" wait: "200" scroll_px: "100" touch_when: onload max_view: "200" scroll_type: px use_scroll_hilight: "0" use_wait: "0" max_pin: "5" use_limit_subs: "0" ApiKey: BAh7CToMY3NyZl9pZCIlMTRmZWMwNTgzNmE0NmZmYjg5NDIxNDlhOTFjZjY1%0AYjQ6C21lbWJlcmkGOg5yZXR1cm5fdG8wIgpmbGFzaElDOidBY3Rpb25Db250%0Acm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--79720c7867f3e5b1ababf83097803a8fc8ccc08f items_per_page: "20" default_public_status: "1" use_prefetch_hack: "0" current_font: "14" EOT; $this->records = array(array('id' => 1, 'username' => 'quentin', 'email' => '*****@*****.**', 'salt' => '7e3041ebc2fc05a40c60028e2c4901a81035d3cd', 'crypted_password' => '00742970dc9e6319f8019fd54864d3ea740f04b1', 'created_on' => date('Y-m-d H:i:s', strtotime('-5 days'))), array('id' => 2, 'username' => 'aaron', 'email' => '*****@*****.**', 'salt' => '7e3041ebc2fc05a40c60028e2c4901a81035d3cd', 'crypted_password' => '00742970dc9e6319f8019fd54864d3ea740f04b1', 'created_on' => date('Y-m-d H:i:s', strtotime('-1 days'))), array('id' => 3, 'username' => 'mala', 'email' => '*****@*****.**', 'salt' => '7e3041ebc2fc05a40c60028e2c4901a81035d3cd', 'crypted_password' => '00742970dc9e6319f8019fd54864d3ea740f04b1', 'config_dump' => $config_dump, 'public' => 1, 'created_on' => date('Y-m-d H:i:s', strtotime('-1 days')))); }
/** * Initialize the fixture. * * @return void */ public function init() { for ($i = 101; $i <= 200; $i++) { $this->records[$i] = array('id' => $i, 'language_id' => '2', 'block_id' => $i, 'key' => 'announcement_' . $i, 'status' => '1', 'is_active' => '1', 'is_latest' => '1', 'content' => 'Announcements content ' . $i); } parent::init(); }
/** * Constructor * */ public function __construct() { parent::__construct(); foreach ($this->records as &$record) { $record['passwd'] = Security::hash($record['passwd'], null, true); } }
/** * {@inheritDoc} */ public function init() { if (empty($this->fields)) { $this->fields = $this->getSchema($this->name); } parent::init(); }
function init() { foreach ($this->records as $index => $record) { $this->records[$index]['created_on'] = date('Y-m-d H:m:s', strtotime($record['created_on'])); } return parent::init(); }
function __construct() { foreach ($this->records as &$record) { $record['file_name'] = CAKE . $record['file_name']; } parent::__construct(); }
/** * Constructor * * @return CartFixture */ public function __construct() { parent::__construct(); foreach ($this->records as &$record) { $record['additional_data'] = serialize($record['additional_data']); } }
function __construct() { parent::__construct(); $Schema = new CakeSchema(array('name' => 'Chaw')); $Schema = $Schema->load(); $this->fields = $Schema->tables['projects']; }
/** * Initialize the fixture. * * @return void */ public function init() { foreach ($this->records as $i => $recode) { $this->records[$i]['path'] = TMP . 'tests' . DS . 'file' . DS . $recode['id'] . DS; } parent::init(); }
/** * Constructor * * @return OrderFixture */ public function __construct() { parent::__construct(); foreach ($this->records as &$record) { $record['cart_snapshot'] = serialize($record['cart_snapshot']); } }
public function __construct() { foreach ($this->records as &$row) { $row['id'] = String::uuid(); } parent::__construct(); }
function __construct() { foreach ($this->records as &$record) { $record['file_name'] = TEST_CAKE_CORE_INCLUDE_PATH . $record['file_name']; } parent::__construct(); }
/** * This is how we initialize this class * note that we pass in the fixture by reference * so all modifications done to it are automatically done * outside of the scope of this class (sweet, no returning) * @return void */ public function __construct() { parent::__construct(); if (is_subclass_of($this, 'AppTestFixture')) { $parentClass = get_parent_class($this); $parentVars = get_class_vars($parentClass); if (isset($parentVars['fields'])) { $this->fields = array_merge($this->fields, $parentVars['fields']); } if (isset($parentVars['records'])) { $this->records = array_merge($this->records, $parentVars['records']); } if (isset($parentVars['options'])) { $this->options = array_merge($this->options, $parentVars['options']); } } // trigger callbacks: before if (method_exists($this, 'beforeRecords')) { $this->beforeRecords(); } // do stuff if ($this->options['fix']) { $this->fixFields(); } if ($this->options['dates']) { $this->cleanupDates(); } // trigger callbacks: after if (method_exists($this, 'afterRecords')) { $this->afterRecords(); } }
/** * Constructor * */ public function __construct() { parent::__construct(); foreach ($this->records as &$record) { $record['password'] = BcryptFormAuthenticate::hash($record['password'], null, true); } }
/** * insert * * @param Object $db * @return array */ public function insert($db) { $result = parent::insert($db); if ($result === true && $db instanceof Postgres) { $this->_fixSequence($db); } return $result; }
/** * Insert the first 35 users. */ public function init() { $this->records = array(); for ($i = 0; $i < 35; $i++) { $this->records[] = array('id' => $i + 1, 'user_id' => $i + 1, 'created' => '2014-12-03 15:00:00'); } parent::init(); }
/** * Constructor * */ public function __construct() { parent::__construct(); $this->User = ClassRegistry::init('Users.User'); foreach ($this->records as &$record) { $record['password'] = $this->User->hash($record['password'], null, true); } }
function create(&$db) { $result = parent::create($db); if ($result) { $db->execute('ALTER TABLE `items` CHANGE `provider_key` `provider_key` BIGINT( 20 ) NULL DEFAULT NULL '); } return $result; }
/** * Inserting 50 users. */ public function init() { $this->records = array(); for ($i = 0; $i < 50; $i++) { $stage = $i < 35 ? 'applied' : 'retired'; $this->records[] = array('id' => $i + 1, 'username' => 'Player' . $i + 1, 'password' => '', 'md5password' => 'e77989ed21758e78331b20e477fc5582', 'admin' => false, 'stage' => $stage, 'timeline' => '00000000000000', 'participations' => 0, 'achievements' => 0, 'created' => '2014-12-03 15:00:00'); } parent::init(); }
/** * Initialize the fixture. * * @return void * @throws MissingModelException Whe importing from a model that does not exist. * @codeCoverageIgnore */ public function init() { $default = array('plugin_key' => 'test_plugin', 'block_key' => 'test_block_paging_key', 'content_key' => 'test_contet_paging', 'comment' => 'Comment %s', 'created_user' => '1', 'created' => '2014-10-09 16:07:57'); for ($i = 0; $i <= 100; $i++) { $comments = array_merge(array(), $default); $comments['comment'] = sprintf($comments['comment'], $i); $this->records[] = $comments; } parent::init(); }
/** * Maps enum fields in the database to strings with a length of 64 */ public function create($db) { foreach ($this->fields as $name => &$field) { if (strstr($field['type'], "enum") !== false) { $field['type'] = 'string'; $field['length'] = 64; } } parent::create($db); }
/** * Inserts records in the database * * @param DboSource $db * @return boolean */ public function insert($db) { if (isset($this->_insert)) { return true; } if (!empty($this->records)) { return parent::insert($db); } return (bool) $db->execute(file_get_contents($this->_getFilePath())); }
public function create($db) { parent::create($db); return ' CREATE TABLE `multilanguage_model` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `object_id` int(11) unsigned NOT NULL, `lang_code` varchar(5) NOT NULL, `name` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8'; }
/** * Override the normal CakeTestFixture::__construct() to get the name * from our pattern * * @author David Kullmann */ public function __construct() { $class = get_class($this); if ($this->name === null) { if (preg_match('/^Elastic(.*)Fixture$/', $class, $matches)) { $this->name = $matches[1]; } else { throw new Exception("ElasticFixtures should have the naming pattern Elastic<Model>Fixture ('{$class}' given)"); } } return parent::__construct(); }
/** * Standings for eight groups. */ public function init() { $this->records = array(); $id = 1; for ($i = 0; $i < 8; $i++) { for ($k = 0; $k < 4; $k++) { $this->records[] = array('id' => $id, 'group_id' => $i + 1, 'user_id' => $id, 'points' => 0, 'games' => 0, 'game_ratio' => 0, 'round_ratio' => 0); $id++; } } parent::init(); }
function init() { foreach ($this->records as $index => $record) { $this->records[$index]['created_on'] = date('Y-m-d H:m:s', strtotime($record['created_on'])); $this->records[$index]['updated_on'] = date('Y-m-d H:m:s', strtotime($record['updated_on'])); $this->records[$index]['due_date'] = date('Y-m-d H:m:s', strtotime($record['due_date'])); if (!empty($record['start_date'])) { $this->records[$index]['start_date'] = date('Y-m-d H:m:s', strtotime($record['start_date'])); } } return parent::init(); }
/** * Initialize the fixture. * * @return void */ public function init() { foreach ($this->records as $i => $recode) { if ($recode['id'] !== '4') { $this->records[$i]['url'] = APP . 'Plugin' . DS . 'RssReaders' . DS . 'Test' . DS . 'Fixture' . DS . 'rss_v1.xml'; } if ($recode['id'] === '3') { $this->records[$i]['modified'] = date('Y-m-d H:i:s'); } } parent::init(); }
public function create($db) { $ok = parent::create($db); // Workaround: CakeSchema cannot create FULLTEXT fixtures, so we change the table manually after creation if ($ok) { $query = "ALTER TABLE `{$this->table}` ADD FULLTEXT INDEX `data` (`data` ASC)"; try { $db->rawQuery($query); $this->created[] = $db->configKeyName; } catch (Exception $e) { $msg = __d('cake_dev', 'Fixture creation for "%s" failed "%s"', $this->table, $e->getMessage()); CakeLog::error($msg); trigger_error($msg, E_USER_WARNING); return false; } return true; } return false; }
/** * {@inheritdoc} */ public function init() { parent::init(); $autoFill = isset($this->fields['created']) || isset($this->fields['modified']) || isset($this->fields['updated']); if (!empty($this->model)) { $Model = ClassRegistry::init($this->model); $stateable = $Model->Behaviors->attached('Stateable'); var_dump($Model->alias); } if (empty($this->defaults) && !$autoFill) { return; } foreach ((array) $this->records as $k => $record) { $this->records[$k] += $this->defaults; foreach (array('created', 'modified', 'updated') as $field) { if (isset($this->fields[$field])) { $this->records[$k] += array($field => date('Y-m-d H:i:s')); } } } }