本文整理汇总了PHP中data::get方法的典型用法代码示例。如果您正苦于以下问题:PHP data::get方法的具体用法?PHP data::get怎么用?PHP data::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data
的用法示例。
在下文中一共展示了data::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAjax
public function testAjax()
{
$this->module->sendAjaxGetRequest('/info');
$this->assertNotNull(data::get('ajax'));
$this->module->sendAjaxPostRequest('/form/complex', array('show' => 'author'));
$this->assertNotNull(data::get('ajax'));
$post = data::get('form');
$this->assertEquals('author', $post['show']);
}
示例2: get_helper
public function get_helper($key)
{
$ret = null;
$in_helper = false;
if (isset($this->helper[$key])) {
$ret = $this->helper[$key];
$in_helper = true;
} else {
$class = 'view_helper_' . $key;
if (class_exists($class)) {
$this->helper[$key] = new $class();
$ret = $this->helper[$key];
$in_helper = true;
} else {
$ret = parent::get($key);
}
}
if ($in_helper) {
$ret->view = $this;
}
return $ret;
}
示例3: testFillFieldWithAmpersand
public function testFillFieldWithAmpersand()
{
$this->module->amOnPage('/form/field');
$this->module->fillField('Name', 'this & that');
$this->module->click('Submit');
$form = data::get('form');
$this->assertEquals('this & that', $form['name']);
}
示例4: testFileFieldByLabel
public function testFileFieldByLabel()
{
$this->module->amOnPage('/form/file');
$this->module->attachFile('Avatar', 'app/avatar.jpg');
$this->module->click('Submit');
$this->assertNotEmpty(data::get('files'));
}
示例5: testSubmitFormWithQueries
/**
* @Issue https://github.com/Codeception/Codeception/issues/933
*/
public function testSubmitFormWithQueries()
{
$this->module->amOnPage('/form/example3');
$this->module->seeElement('form');
$this->module->submitForm('form', array('name' => 'jon'));
$form = data::get('form');
$this->assertEquals('jon', $form['name']);
$this->module->seeCurrentUrlEquals('/form/example3?validate=yes');
}
示例6: getUser
public static function getUser()
{
if (self::$session && self::$session['logged_in'] == 1 && !isset(self::$user)) {
$res = data::get('user', 'get', array('users_id'));
self::$user = false;
if (!$res['error']) {
self::$user = $res['data'];
}
}
return self::$user;
}
示例7: parse_view
/**
* parse the rendered view for {{placeholders}} and replace them
* @param string $view the rendered view (typically html) possibly containing {{placeholders}}
* @return string
*/
private function parse_view($view)
{
$v = view::getInstance();
$app = \maverick\maverick::getInstance();
// check for the use of multi-lingual gettext stuff
if ($app->get_config('lang.active') !== false) {
// match the format of {{_('string to translate')}} - the quote style can be either single or double,
// and the text to translate must start with a letter \p{L}
if (preg_match_all('/\\{\\{_\\(([\'"]\\p{L}[^\'"]+[\'"])\\)\\}\\}/', $view, $matches) && !empty($matches[1])) {
$find = $replace = array();
foreach ($matches[1] as $match) {
$find[] = "{{_({$match})}}";
$replace[] = _(trim($match, "\"'"));
}
$view = str_replace($find, $replace, $view);
}
}
// run any custom handlers that have been added - the callback will pass up to three matched parameters in the form
// {{handler_namespacee:param1:param2:param3}} with each matched parameter being in an array with
// param1 being array index 1, param2 being array index 3, and param3 being array index5
// the callback method must be a static method, and the return must be a string
if (count($v->parse_handlers)) {
foreach ($v->parse_handlers as $parse_handler) {
list($controller, $method) = explode('->', $parse_handler[1]);
$view = preg_replace_callback("/\\{\\{{$parse_handler[0]}:([\\p{L}\\p{N}_]+)(:([\\p{L}\\p{N}_]+))?(:([\\p{L}\\p{N}_]+))?\\}\\}/", array($controller, $method), $view);
}
}
// match simple placeholder formats - this check should always be last
if (preg_match_all('/\\{\\{(\\p{L}[\\p{L}\\p{N}_\\.]+)/', $view, $matches) && !empty($matches[1])) {
$find = $replace = array();
foreach ($matches[1] as $match) {
$find[] = "{{{$match}}}";
$r = \data::get($match);
if (is_array($r)) {
$r = implode($r);
}
$replace[] = $r;
}
$view = str_replace($find, $replace, $view);
}
return $view;
}
示例8: testUnreachableField
/**
* @Issue https://github.com/Codeception/Codeception/issues/1585
* @Issue https://github.com/Codeception/Codeception/issues/1602
*/
public function testUnreachableField()
{
$this->module->amOnPage('/form/bug1585');
$this->module->fillField('textarea[name="captions[]"]', 'test2');
$this->module->fillField('items[1][]', 'test3');
$this->module->fillField('input[name="users[]"]', 'davert');
$this->module->attachFile('input[name="files[]"]', 'app/avatar.jpg');
$this->module->click('Submit');
$data = data::get('form');
$this->assertContains('test3', $data['items'][1]);
$this->assertContains('test2', $data['captions']);
$this->assertContains('davert', $data['users']);
}
示例9:
<?php
include MAVERICK_VIEWSDIR . 'includes/header.php';
include MAVERICK_VIEWSDIR . '' . data::get('page') . '.php';
include MAVERICK_VIEWSDIR . 'includes/footer.php';
示例10: testSelectOptionValueSelector
public function testSelectOptionValueSelector()
{
$this->module->amOnPage('/form/select_selectors');
$this->module->selectOption('age', ['value' => '20']);
$this->module->click('Submit');
$data = data::get('form');
$this->assertEquals('20', $data['age']);
}
示例11: testFormWithFileSpecialCharNames
public function testFormWithFileSpecialCharNames()
{
$this->module->amOnPage('/form/example14');
$this->module->attachFile('foo bar', 'app/avatar.jpg');
$this->module->attachFile('foo.baz', 'app/avatar.jpg');
$this->module->click('Submit');
$this->assertNotEmpty(data::get('files'));
$files = data::get('files');
$this->assertNotEmpty($files);
$this->assertArrayHasKey('foo_bar', $files);
$this->assertArrayHasKey('foo_baz', $files);
}
示例12: testSubmitFormDoesNotKeepGetParameters
/**
* @issue https://github.com/Codeception/Codeception/issues/2841
*/
public function testSubmitFormDoesNotKeepGetParameters()
{
$this->module->amOnPage('/form/bug2841?stuff=other');
$this->module->fillField('#texty', 'thingshjere');
$this->module->click('#submit-registration');
$this->assertEmpty(data::get('query'), 'Query string is not empty');
}
示例13: testArrayFieldSubmitForm
public function testArrayFieldSubmitForm()
{
$this->module->amOnPage('/form/example17');
$this->module->submitForm('form', ['FooBar' => ['bar' => 'booze'], 'Food' => ['beer' => ['yum' => ['yeah' => 'crunked']]]]);
$data = data::get('form');
$this->assertEquals('booze', $data['FooBar']['bar']);
$this->assertEquals('crunked', $data['Food']['beer']['yum']['yeah']);
}
示例14: testComplexSelectorsAndForms
public function testComplexSelectorsAndForms()
{
$this->module->amOnPage('/login');
$this->module->submitForm('form#user_form_login', array('email' => 'miles@davis.com', 'password' => '111111'));
$post = data::get('form');
$this->assertEquals('miles@davis.com', $post['email']);
}
示例15: testComplexFormsAndXPath
public function testComplexFormsAndXPath()
{
$this->module->amOnPage('/login');
$this->module->submitForm("descendant-or-self::form[@id='user_form_login']", array('email' => 'miles@davis.com', 'password' => '111111'));
$post = data::get('form');
$this->assertEquals('miles@davis.com', $post['email']);
}