Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
|
@ -5,6 +5,6 @@ package: Testing
|
|||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- action
|
||||
- views
|
||||
- node
|
||||
- drupal:action
|
||||
- drupal:views
|
||||
- drupal:node
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
name: action_form_ajax_test
|
||||
type: module
|
||||
description: 'module used for testing ajax in action config entity forms.'
|
||||
package: Core
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
hidden: true
|
|
@ -0,0 +1,7 @@
|
|||
action.configuration.action_form_ajax_test:
|
||||
type: action_configuration_default
|
||||
label: 'action_form_ajax_test action'
|
||||
mapping:
|
||||
party_time:
|
||||
type: string
|
||||
label: 'The time of the party.'
|
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\action_form_ajax_test\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
use Drupal\Core\Action\ConfigurableActionBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
|
||||
/**
|
||||
* Plugin used for testing AJAX in action config entity forms.
|
||||
*
|
||||
* @Action(
|
||||
* id = "action_form_ajax_test",
|
||||
* label = @Translation("action_form_ajax_test"),
|
||||
* type = "system"
|
||||
* )
|
||||
*/
|
||||
class ActionAjaxTest extends ConfigurableActionBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function defaultConfiguration() {
|
||||
return [
|
||||
'party_time' => '',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
|
||||
$result = AccessResult::allowed();
|
||||
return $return_as_object ? $result : $result->isAllowed();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute() {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
|
||||
$having_a_party = $form_state->getValue('having_a_party', !empty($this->configuration['party_time']));
|
||||
$form['having_a_party'] = [
|
||||
'#type' => 'checkbox',
|
||||
'#title' => $this->t('Are we having a party?'),
|
||||
'#ajax' => [
|
||||
'wrapper' => 'party-container',
|
||||
'callback' => [$this, 'partyCallback'],
|
||||
],
|
||||
'#default_value' => $having_a_party,
|
||||
];
|
||||
$form['container'] = [
|
||||
'#type' => 'container',
|
||||
'#prefix' => '<div id="party-container">',
|
||||
'#suffix' => '</div>',
|
||||
];
|
||||
|
||||
if ($having_a_party) {
|
||||
$form['container']['party_time'] = [
|
||||
'#type' => 'textfield',
|
||||
'#title' => $this->t('Party time'),
|
||||
'#default_value' => $this->configuration['party_time'],
|
||||
];
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for party checkbox.
|
||||
*/
|
||||
public function partyCallback(array $form, FormStateInterface $form_state) {
|
||||
return $form['container'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
|
||||
$this->configuration['party_time'] = $form_state->getValue('party_time');
|
||||
}
|
||||
|
||||
}
|
|
@ -28,10 +28,10 @@ class ActionListTest extends BrowserTestBase {
|
|||
// Ensure the empty text appears on the action list page.
|
||||
/** @var $storage \Drupal\Core\Entity\EntityStorageInterface */
|
||||
$storage = $this->container->get('entity.manager')->getStorage('action');
|
||||
$actions = $storage->loadMultiple();
|
||||
$actions = $storage->loadMultiple();
|
||||
$storage->delete($actions);
|
||||
$this->drupalGet('/admin/config/system/actions');
|
||||
$this->assertRaw('There is no Action yet.');
|
||||
$this->assertRaw('There are no actions yet.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class ActionUninstallTest extends BrowserTestBase {
|
|||
|
||||
$storage = $this->container->get('entity_type.manager')->getStorage('action');
|
||||
$storage->resetCache(['user_block_user_action']);
|
||||
$this->assertTrue($storage->load('user_block_user_action'), 'Configuration entity \'user_block_user_action\' still exists after uninstalling action module.' );
|
||||
$this->assertTrue($storage->load('user_block_user_action'), 'Configuration entity \'user_block_user_action\' still exists after uninstalling action module.');
|
||||
|
||||
$admin_user = $this->drupalCreateUser(['administer users']);
|
||||
$this->drupalLogin($admin_user);
|
||||
|
|
|
@ -148,7 +148,7 @@ class BulkFormTest extends BrowserTestBase {
|
|||
$errors = $this->xpath('//div[contains(@class, "messages--status")]');
|
||||
$this->assertFalse($errors, 'No action message shown.');
|
||||
$this->drupalPostForm(NULL, [], t('Delete'));
|
||||
$this->assertText(t('Deleted 5 posts.'));
|
||||
$this->assertText(t('Deleted 5 content items.'));
|
||||
// Check if we got redirected to the original page.
|
||||
$this->assertUrl('test_bulk_form');
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Drupal\Tests\action\Functional;
|
||||
|
||||
use Drupal\Component\Utility\Crypt;
|
||||
use Drupal\system\Entity\Action;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
|
@ -31,7 +30,7 @@ class ConfigurationTest extends BrowserTestBase {
|
|||
|
||||
// Make a POST request to admin/config/system/actions.
|
||||
$edit = [];
|
||||
$edit['action'] = Crypt::hashBase64('action_goto_action');
|
||||
$edit['action'] = 'action_goto_action';
|
||||
$this->drupalPostForm('admin/config/system/actions', $edit, t('Create'));
|
||||
$this->assertResponse(200);
|
||||
|
||||
|
@ -41,17 +40,18 @@ class ConfigurationTest extends BrowserTestBase {
|
|||
$edit['label'] = $action_label;
|
||||
$edit['id'] = strtolower($action_label);
|
||||
$edit['url'] = 'admin';
|
||||
$this->drupalPostForm('admin/config/system/actions/add/' . Crypt::hashBase64('action_goto_action'), $edit, t('Save'));
|
||||
$this->drupalPostForm('admin/config/system/actions/add/action_goto_action', $edit, t('Save'));
|
||||
$this->assertResponse(200);
|
||||
|
||||
$action_id = $edit['id'];
|
||||
|
||||
// Make sure that the new complex action was saved properly.
|
||||
$this->assertText(t('The action has been successfully saved.'), "Make sure we get a confirmation that we've successfully saved the complex action.");
|
||||
$this->assertText($action_label, "Make sure the action label appears on the configuration page after we've saved the complex action.");
|
||||
|
||||
// Make another POST request to the action edit page.
|
||||
$this->clickLink(t('Configure'));
|
||||
preg_match('|admin/config/system/actions/configure/(.+)|', $this->getUrl(), $matches);
|
||||
$aid = $matches[1];
|
||||
|
||||
$edit = [];
|
||||
$new_action_label = $this->randomMachineName();
|
||||
$edit['label'] = $new_action_label;
|
||||
|
@ -73,7 +73,7 @@ class ConfigurationTest extends BrowserTestBase {
|
|||
$this->clickLink(t('Delete'));
|
||||
$this->assertResponse(200);
|
||||
$edit = [];
|
||||
$this->drupalPostForm("admin/config/system/actions/configure/$aid/delete", $edit, t('Delete'));
|
||||
$this->drupalPostForm(NULL, $edit, t('Delete'));
|
||||
$this->assertResponse(200);
|
||||
|
||||
// Make sure that the action was actually deleted.
|
||||
|
@ -82,7 +82,7 @@ class ConfigurationTest extends BrowserTestBase {
|
|||
$this->assertResponse(200);
|
||||
$this->assertNoText($new_action_label, "Make sure the action label does not appear on the overview page after we've deleted the action.");
|
||||
|
||||
$action = Action::load($aid);
|
||||
$action = Action::load($action_id);
|
||||
$this->assertFalse($action, 'Make sure the action is gone after being deleted.');
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\action\FunctionalJavascript;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
|
||||
use Drupal\system\Entity\Action;
|
||||
|
||||
/**
|
||||
* Tests action plugins using Javascript.
|
||||
*
|
||||
* @group action
|
||||
*/
|
||||
class ActionFormAjaxTest extends WebDriverTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $modules = ['action', 'action_form_ajax_test'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$user = $this->drupalCreateUser(['administer actions']);
|
||||
$this->drupalLogin($user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests action plugins with AJAX save their configuration.
|
||||
*/
|
||||
public function testActionConfigurationWithAjax() {
|
||||
$url = Url::fromRoute('action.admin_add', ['action_id' => 'action_form_ajax_test']);
|
||||
$this->drupalGet($url);
|
||||
$page = $this->getSession()->getPage();
|
||||
|
||||
$id = 'test_plugin';
|
||||
$this->assertSession()->waitForElementVisible('named', ['button', 'Edit'])->press();
|
||||
$this->assertSession()->waitForElementVisible('css', '[name="id"]')->setValue($id);
|
||||
|
||||
$page->find('css', '[name="having_a_party"]')
|
||||
->check();
|
||||
$this->assertSession()->waitForElementVisible('css', '[name="party_time"]');
|
||||
|
||||
$party_time = 'Evening';
|
||||
$page->find('css', '[name="party_time"]')
|
||||
->setValue($party_time);
|
||||
|
||||
$page->find('css', '[value="Save"]')
|
||||
->click();
|
||||
|
||||
$url = Url::fromRoute('entity.action.collection');
|
||||
$this->assertSession()->pageTextContains('The action has been successfully saved.');
|
||||
$this->assertSession()->addressEquals($url);
|
||||
|
||||
// Check storage.
|
||||
$instance = Action::load($id);
|
||||
$configuration = $instance->getPlugin()->getConfiguration();
|
||||
$this->assertEquals(['party_time' => $party_time], $configuration);
|
||||
|
||||
// Configuration should be shown in edit form.
|
||||
$this->drupalGet($instance->toUrl('edit-form'));
|
||||
$this->assertSession()->checkboxChecked('having_a_party');
|
||||
$this->assertSession()->fieldValueEquals('party_time', $party_time);
|
||||
}
|
||||
|
||||
}
|
|
@ -40,7 +40,7 @@ class MigrateActionsTest extends MigrateDrupal6TestBase {
|
|||
$this->assertEntity('send_e_mail', 'Send e-mail', 'system', [
|
||||
"recipient" => "test@example.com",
|
||||
"subject" => "Drupal migration test",
|
||||
"message" => "Drupal migration test"
|
||||
"message" => "Drupal migration test",
|
||||
]);
|
||||
$this->assertEntity('redirect_to_url', 'Redirect to URL', 'system', ["url" => "https://www.drupal.org"]);
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class MigrateActionsTest extends MigrateDrupal7TestBase {
|
|||
$this->assertEntity('send_e_mail', 'Send e-mail', 'system', [
|
||||
"recipient" => "test@example.com",
|
||||
"subject" => "Drupal migration test",
|
||||
"message" => "Drupal migration test"
|
||||
"message" => "Drupal migration test",
|
||||
]);
|
||||
$this->assertEntity('redirect_to_url', 'Redirect to URL', 'system', ["url" => "https://www.drupal.org"]);
|
||||
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\action\Kernel\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Test\AssertMailTrait;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests for the EmailAction plugin.
|
||||
*
|
||||
* @group action
|
||||
*/
|
||||
class EmailActionTest extends KernelTestBase {
|
||||
use AssertMailTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['system', 'user', 'action', 'dblog'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('user');
|
||||
$this->installSchema('dblog', ['watchdog']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the email action plugin.
|
||||
*/
|
||||
public function testEmailAction() {
|
||||
/** @var \Drupal\Core\Action\ActionManager $plugin_manager */
|
||||
$plugin_manager = $this->container->get('plugin.manager.action');
|
||||
$configuration = [
|
||||
'recipient' => 'test@example.com',
|
||||
'subject' => 'Test subject',
|
||||
'message' => 'Test message',
|
||||
];
|
||||
$plugin_manager
|
||||
->createInstance('action_send_email_action', $configuration)
|
||||
->execute();
|
||||
|
||||
$mails = $this->getMails();
|
||||
$this->assertCount(1, $this->getMails());
|
||||
$this->assertEquals('test@example.com', $mails[0]['to']);
|
||||
$this->assertEquals('Test subject', $mails[0]['subject']);
|
||||
$this->assertEquals("Test message\n", $mails[0]['body']);
|
||||
|
||||
// Ensure that the email sending is logged.
|
||||
$log = \Drupal::database()
|
||||
->select('watchdog', 'w')
|
||||
->fields('w', ['message', 'variables'])
|
||||
->orderBy('wid', 'DESC')
|
||||
->range(0, 1)
|
||||
->execute()
|
||||
->fetch();
|
||||
|
||||
$this->assertEquals($log->message, 'Sent email to %recipient');
|
||||
$variables = unserialize($log->variables);
|
||||
$this->assertEquals($variables['%recipient'], 'test@example.com');
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,7 @@ class ActionTest extends MigrateSqlSourceTestBase {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['action', 'migrate_drupal'];
|
||||
public static $modules = ['action', 'migrate_drupal', 'system'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
Reference in a new issue