本文整理汇总了PHP中batch_test_stack函数的典型用法代码示例。如果您正苦于以下问题:PHP batch_test_stack函数的具体用法?PHP batch_test_stack怎么用?PHP batch_test_stack使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了batch_test_stack函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
batch_test_stack(NULL, TRUE);
$function = '_batch_test_' . $form_state->getValue('batch');
batch_set($function());
$form_state->setRedirect('batch_test.redirect');
}
示例2: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, array &$form_state)
{
batch_test_stack(NULL, TRUE);
$function = '_batch_test_' . $form_state['values']['batch'];
batch_set($function());
$form_state['redirect_route'] = new Url('batch_test.redirect');
}
示例3: batchTestChainedFormSubmit4
/**
* Form submission handler #4 for batch_test_chained_form
*/
public static function batchTestChainedFormSubmit4($form, FormStateInterface $form_state)
{
batch_test_stack('submit handler 4');
batch_test_stack('value = ' . $form_state['values']['value']);
$form_state['values']['value']++;
batch_set(_batch_test_batch_3());
$form_state->setRedirect('batch_test.redirect');
}
示例4: batchTestChainedFormSubmit4
/**
* Form submission handler #4 for batch_test_chained_form
*/
public static function batchTestChainedFormSubmit4($form, &$form_state)
{
batch_test_stack('submit handler 4');
batch_test_stack('value = ' . $form_state['values']['value']);
$form_state['values']['value']++;
batch_set(_batch_test_batch_3());
$form_state['redirect_route'] = new Url('batch_test.redirect');
}
示例5: testBatchProgressPageTitle
/**
* Tests that the batch API progress page shows the title correctly.
*/
function testBatchProgressPageTitle()
{
// Visit an administrative page that runs a test batch, and check that the
// title shown during batch execution (which the batch callback function
// saved as a variable) matches the theme used on the administrative page.
$this->drupalGet('batch-test/test-title');
// The stack should contain the title shown on the progress page.
$this->assertEqual(batch_test_stack(), ['Batch Test'], 'The batch title is shown on the batch page.');
$this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
}
示例6: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
batch_test_stack(NULL, TRUE);
switch ($form_state['storage']['step']) {
case 1:
batch_set(_batch_test_batch_1());
break;
case 2:
batch_set(_batch_test_batch_2());
break;
}
if ($form_state['storage']['step'] < 2) {
$form_state['storage']['step']++;
$form_state['rebuild'] = TRUE;
}
$form_state->setRedirect('batch_test.redirect');
}
示例7: testBatchProgressPageTheme
/**
* Tests that the batch API progress page uses the correct theme.
*/
function testBatchProgressPageTheme()
{
// Make sure that the page which starts the batch (an administrative page)
// is using a different theme than would normally be used by the batch API.
$this->container->get('theme_handler')->install(array('seven', 'bartik'));
$this->container->get('config.factory')->get('system.theme')->set('default', 'bartik')->set('admin', 'seven')->save();
// Log in as an administrator who can see the administrative theme.
$admin_user = $this->drupalCreateUser(array('view the administration theme'));
$this->drupalLogin($admin_user);
// Visit an administrative page that runs a test batch, and check that the
// theme that was used during batch execution (which the batch callback
// function saved as a variable) matches the theme used on the
// administrative page.
$this->drupalGet('admin/batch-test/test-theme');
// The stack should contain the name of the theme used on the progress
// page.
$this->assertEqual(batch_test_stack(), array('seven'), 'A progressive batch correctly uses the theme of the page that started the batch.');
}
示例8: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
batch_test_stack(NULL, TRUE);
$step = $form_state->get('step');
switch ($step) {
case 1:
batch_set(_batch_test_batch_1());
break;
case 2:
batch_set(_batch_test_batch_2());
break;
}
if ($step < 2) {
$form_state->set('step', ++$step);
$form_state->setRebuild();
}
$form_state->setRedirect('batch_test.redirect');
}
示例9: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, array &$form_state)
{
batch_test_stack('mock form submitted with value = ' . $form_state['values']['test_value']);
}
示例10: testBatchLargePercentage
/**
* Tests batches that return $context['finished'] > 1 do in fact complete.
*
* @see https://www.drupal.org/node/600836
*/
function testBatchLargePercentage()
{
// Displaying the page triggers batch 5.
$this->drupalGet('batch-test/large-percentage');
$this->assertBatchMessages($this->_resultMessages('batch_5'), 'Batch for step 2 performed successfully.');
$this->assertEqual(batch_test_stack(), $this->_resultStack('batch_5'), 'Execution order was correct.');
$this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
}
示例11: testTitleBatch
/**
* Runs a batch for testing the title shown on the progress page.
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse|null
* A redirect response if the batch is progressive. No return value otherwise.
*/
public function testTitleBatch()
{
batch_test_stack(NULL, TRUE);
$batch = ['title' => 'Batch Test', 'operations' => [['_batch_test_title_callback', []]]];
batch_set($batch);
return batch_process('batch-test/redirect');
}
示例12: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
batch_test_stack('mock form submitted with value = ' . $form_state->getValue('test_value'));
}
示例13: testThemeBatch
/**
* Runs a batch for testing theme used on the progress page.
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse|null
* A redirect response if the batch is progressive. No return value otherwise.
*/
public function testThemeBatch()
{
batch_test_stack(NULL, TRUE);
$batch = array('operations' => array(array('_batch_test_theme_callback', array())));
batch_set($batch);
return batch_process('batch-test/redirect');
}