Loading .travis.yml +31 −41 Changes for .travis.yml: 31 added lines, 41 removed lines. Original line number Diff line number Diff line Loading @@ -20,46 +20,38 @@ jobs: - php: 7.2 env: - DRUPAL_CORE=8.9.x # 8.9 is slow, 50 mins is the Travis limit, so skip media and product. # Also skip Rules because Typed Data cannot be installed at 8.x. # 8.9 is slow, 50 mins is the Travis limit, so skip all additional # entity types. Also skip Rules because it cannot be installed at 8.x. - MEDIA=NO - PRODUCTS=NO - RULES=NO # ---- Remaining self deprecation notices (0) # ---- Remaining direct deprecation notices (0) - php: 7.4 - php: 7.3 env: - DRUPAL_CORE=9.1.x # ---- Remaining self deprecation notices (3157) # 3144 EventDispatcher (in Rules and Commerce Product module) - NODE=NO - MEDIA=NO # ---- Remaining self deprecation notices (1794) # 1774 EventDispatcher with string event (Rules and Commerce) # 11 Creating an instance of class ... getConnection()->condition() # 7 Symfony\Component\EventDispatcher\Event is deprecated (Rules) # 2 Kernel $modules property must be declared protected # ---- Remaining direct deprecation notices (0) - DEPRECATIONS=3157 - php: 7.4 env: - DRUPAL_CORE=9.1.x # Have a second 9.1 run which excludes the Rules and Products tests. - RULES=NO - PRODUCTS=NO # ---- Remaining self deprecation notices (997) # 995 EventDispatcherInterface::dispatch() # 2 Kernel $modules property must be declared protected # ---- Remaining direct deprecation notices (0) - DEPRECATIONS=997 - DEPRECATIONS=3000 - php: 7.4 env: - DRUPAL_CORE=9.2.x # Exclude Rules and Products tests. - RULES=NO # Exclude Rules, Products and Taxonomy tests. Just run Node and Media. - PRODUCTS=NO # ---- Remaining self deprecation notices (2335) # 1120 Symfony isMasterRequest() is deprecated, use isMainRequest() # 877 EventDispatcherInterface::dispatch() # 336 hook_field_widget_form_alter() in Commerce_product setup. - RULES=NO # ---- Remaining self deprecation notices (2455) # 1174 Symfony isMasterRequest() is deprecated, use isMainRequest() # 927 EventDispatcher with string event (Rules and Commerce) # 352 hook_field_widget_form_alter() in Commerce_product setup. # 2 Kernel $modules property must be declared protected # ---- Remaining direct deprecation notices (0) - DEPRECATIONS=2335 - DEPRECATIONS=2455 # Be sure to cache composer downloads. cache: Loading Loading @@ -136,21 +128,22 @@ before_script: - echo $SYMFONY_DEPRECATIONS_HELPER script: - echo "NODE=$NODE MEDIA=$MEDIA PRODUCTS=$PRODUCTS RULES=$RULES" - EXCLUDE=() - if [ "$NODE" == "NO" ]; then EXCLUDE+=('#node|BasicNode'); fi - if [ "$MEDIA" == "NO" ]; then EXCLUDE+=('#media|BasicMedia'); fi - if [ "$PRODUCTS" == "NO" ]; then EXCLUDE+=('#commerce_product|BasicProduct'); fi - if [ "$RULES" == "NO" ]; then EXCLUDE+=('rules'); fi - EXCLUDE=${EXCLUDE[@]} # create a space delimited string from array # Run the PHPUnit tests. - cd $DRUPAL_ROOT - | if [[ "$MEDIA" == "NO" && "$PRODUCTS" == "NO" && "$RULES" == "NO" ]]; then echo "Running tests excluding Media, Products and Rules ..." ./vendor/bin/phpunit -c ./core/phpunit.xml.dist --debug ./modules/$MODULE/ --filter '/^((?!(media|product|rules)).)*$/i' elif [[ "$MEDIA" == "NO" && "$PRODUCTS" == "NO" ]]; then echo "Running tests excluding Media and Products ..." ./vendor/bin/phpunit -c ./core/phpunit.xml.dist --debug ./modules/$MODULE/ --filter '/^((?!(media|product)).)*$/i' elif [[ "$RULES" == "NO" && "$PRODUCTS" == "NO" ]]; then echo "Running tests excluding Rules and Products ..." ./vendor/bin/phpunit -c ./core/phpunit.xml.dist --debug ./modules/$MODULE/ --filter '/^((?!(rules|product)).)*$/i' elif [ "$RULES" == "NO" ]; then echo "Running tests excluding Rules ..." ./vendor/bin/phpunit -c ./core/phpunit.xml.dist --debug ./modules/$MODULE/ --filter '/^((?!rules).)*$/i' if [ "$EXCLUDE" != "" ]; then echo "Running tests excluding $EXCLUDE ..." export FILTER="/^((?!(${EXCLUDE// /|})).)*$/i" # use parameter expansion to substitute spaces with | echo "FILTER=$FILTER" ./vendor/bin/phpunit -c ./core/phpunit.xml.dist --debug ./modules/$MODULE/ --filter "$FILTER" else echo "Running all tests ..." ./vendor/bin/phpunit -c ./core/phpunit.xml.dist --debug ./modules/$MODULE/ Loading @@ -168,8 +161,5 @@ script: - $DRUPAL_ROOT/vendor/bin/phpcs -i - $DRUPAL_ROOT/vendor/bin/phpcs -e # Show the violations in detail, plus summary and source report. Do not run on # Core 8.8 as there are faults which are fixed using a newer version of Coder. - if [ "$DRUPAL_CORE" != "8.8.x" ]; then $DRUPAL_ROOT/vendor/bin/phpcs . --report-full --report-summary --report-source -s; fi # Show the violations in detail, plus summary and source report. - $DRUPAL_ROOT/vendor/bin/phpcs . --report-full --report-summary --report-source -s; scheduler_rules_integration/tests/src/Functional/SchedulerRulesActionsTest.php +33 −47 Changes for scheduler_rules_integration/tests/src/Functional/SchedulerRulesActionsTest.php: 33 added lines, 47 removed lines. Original line number Diff line number Diff line Loading @@ -32,28 +32,13 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { } /** * Provides test data. * * @return array * Each array item has the values: * [entity type id, enabled bundle id, non-enabled bundle id]. */ public function dataRulesActions() { $data = [ '#node' => ['node', $this->type, $this->nonSchedulerType], '#media' => ['media', $this->mediaTypeName, $this->nonSchedulerMediaTypeName], '#commerce_product' => ['commerce_product', $this->productTypeName, $this->nonSchedulerProductTypeName], ]; return $data; } /** * Tests the actions which set and remove the 'Publish On' date. * * @dataProvider dataRulesActions() * @dataProvider dataStandardEntityTypes() */ public function testPublishOnActions($entityTypeId, $enabled, $nonEnabled) { public function testPublishOnActions($entityTypeId, $enabledBundle) { $nonEnabledBundle = $this->entityTypeObject($entityTypeId, 'non-enabled')->id(); $titleField = ($entityTypeId == 'media') ? 'name' : 'title'; $publish_on = $this->requestTime + 1800; $publish_on_formatted = $this->dateFormatter->format($publish_on, 'long'); Loading Loading @@ -128,8 +113,8 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { $assert = $this->assertSession(); // First, create a new scheduler-enabled entity, triggering rule 1. $title = "First - new enabled $enabled - Trigger Rule 1"; $this->drupalGet($this->entityAddUrl($entityTypeId, $enabled)); $title = "First - new enabled $enabledBundle - Trigger Rule 1"; $this->drupalGet($this->entityAddUrl($entityTypeId, $enabledBundle)); $this->submitForm(["{$titleField}[0][value]" => $title], 'Save'); $entity = $this->getEntityByTitle($entityTypeId, $title); $this->assertSession()->pageTextContains(sprintf('%s is scheduled to be published %s', $title, $publish_on_formatted)); Loading @@ -144,11 +129,11 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Second, edit a pre-existing Scheduler-enabled entity, without triggering // either of the rules. $entity = $this->createEntity($entityTypeId, $enabled, [ "$titleField" => "Second - existing enabled $enabled", $entity = $this->createEntity($entityTypeId, $enabledBundle, [ "$titleField" => "Second - existing enabled $enabledBundle", ]); $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabled - but no rules will be triggered"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabledBundle - but no rules will be triggered"], 'Save'); $storage->resetCache([$entity->id()]); $entity = $storage->load($entity->id()); // Check that neither of the rules are triggered, no publish and unpublish Loading @@ -161,7 +146,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Edit the entity, triggering rule 1. $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabled - Trigger Rule 1"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabledBundle - Trigger Rule 1"], 'Save'); $storage->resetCache([$entity->id()]); $entity = $storage->load($entity->id()); // Check that rule 1 is triggered and rule 2 is not. Check that a publishing Loading @@ -174,7 +159,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Edit the entity, triggering rule 2. $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabled - Trigger Rule 2"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabledBundle - Trigger Rule 2"], 'Save'); $storage->resetCache([$entity->id()]); $entity = $storage->load($entity->id()); // Check that rule 2 is triggered and rule 1 is not. Check that the Loading @@ -186,8 +171,8 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { $this->assertTrue($entity->isPublished(), 'Entity should be published.'); // Third, create a new entity which is not scheduler-enabled. $title = "Third - new non-enabled $nonEnabled - Trigger Rule 1"; $this->drupalGet($this->entityAddUrl($entityTypeId, $nonEnabled)); $title = "Third - new non-enabled $nonEnabledBundle - Trigger Rule 1"; $this->drupalGet($this->entityAddUrl($entityTypeId, $nonEnabledBundle)); $this->submitForm(["{$titleField}[0][value]" => $title], 'Save'); $entity = $this->getEntityByTitle($entityTypeId, $title); // Check that rule 1 issued a warning message. Loading @@ -206,11 +191,11 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Fourthly, edit a pre-existing entity which is not enabled for Scheduler, // triggering rule 1. $entity = $this->createEntity($entityTypeId, $nonEnabled, [ "$titleField" => "Fourth - existing non-enabled $nonEnabled", $entity = $this->createEntity($entityTypeId, $nonEnabledBundle, [ "$titleField" => "Fourth - existing non-enabled $nonEnabledBundle", ]); $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabled - Trigger Rule 1"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabledBundle - Trigger Rule 1"], 'Save'); // Check that rule 1 issued a warning message. $assert->pageTextContains('warning message'); $assert->elementExists('xpath', '//div[@aria-label="Warning message" and contains(string(), "Action")]'); Loading @@ -227,7 +212,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Edit the entity again, triggering rule 2. $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabled - Trigger Rule 2"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabledBundle - Trigger Rule 2"], 'Save'); // Check that rule 2 issued a warning message. $assert->pageTextContains('warning message'); $assert->elementExists('xpath', '//div[@aria-label="Warning message" and contains(string(), "Action")]'); Loading @@ -245,9 +230,10 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { /** * Tests the actions which set and remove the 'Unpublish On' date. * * @dataProvider dataRulesActions() * @dataProvider dataStandardEntityTypes() */ public function testUnpublishOnActions($entityTypeId, $enabled, $nonEnabled) { public function testUnpublishOnActions($entityTypeId, $enabledBundle) { $nonEnabledBundle = $this->entityTypeObject($entityTypeId, 'non-enabled')->id(); $titleField = ($entityTypeId == 'media') ? 'name' : 'title'; $unpublish_on = $this->requestTime + 2400; $unpublish_on_formatted = $this->dateFormatter->format($unpublish_on, 'long'); Loading Loading @@ -298,7 +284,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { ->setValue('operation', 'contains') ->setValue('value', 'Trigger Rule 4') ); $message4 = 'RULES message 4. Action to remove Unpublish-on date and unpublish the node immediately.'; $message4 = "RULES message 4. Action to remove Unpublish-on date and unpublish the $entityTypeId immediately."; $rule4->addAction("scheduler_remove_unpublishing_date$action_suffix", ContextConfig::create() ->map("$entityTypeId", "$entityTypeId") Loading @@ -322,8 +308,8 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { $assert = $this->assertSession(); // First, create a new scheduler-enabled entity, triggering rule 3. $title = "First - new enabled $enabled - Trigger Rule 3"; $this->drupalGet($this->entityAddUrl($entityTypeId, $enabled)); $title = "First - new enabled $enabledBundle - Trigger Rule 3"; $this->drupalGet($this->entityAddUrl($entityTypeId, $enabledBundle)); $this->submitForm(["{$titleField}[0][value]" => $title], 'Save'); $entity = $this->getEntityByTitle($entityTypeId, $title); $this->assertSession()->pageTextContains(sprintf('%s is scheduled to be unpublished %s', $title, $unpublish_on_formatted)); Loading @@ -338,11 +324,11 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Second, edit a pre-existing Scheduler-enabled entity, without triggering // either of the rules. $entity = $this->createEntity($entityTypeId, $enabled, [ "$titleField" => "Second - existing enabled $enabled", $entity = $this->createEntity($entityTypeId, $enabledBundle, [ "$titleField" => "Second - existing enabled $enabledBundle", ]); $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabled - but no rules will be triggered"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabledBundle - but no rules will be triggered"], 'Save'); $storage->resetCache([$entity->id()]); $entity = $storage->load($entity->id()); // Check that neither of the rules are triggered, no publish and unpublish Loading @@ -355,7 +341,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Edit the entity, triggering rule 3. $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabled - Trigger Rule 3"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabledBundle - Trigger Rule 3"], 'Save'); $storage->resetCache([$entity->id()]); $entity = $storage->load($entity->id()); // Check that rule 3 is triggered and rule 4 is not. Check that an Loading @@ -368,7 +354,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Edit the entity, triggering rule 4. $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabled - Trigger Rule 4"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabledBundle - Trigger Rule 4"], 'Save'); $storage->resetCache([$entity->id()]); $entity = $storage->load($entity->id()); // Check that rule 4 is triggered and rule 3 is not. Check that the Loading @@ -380,8 +366,8 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { $this->assertFalse($entity->isPublished(), 'Entity should be unpublished.'); // Third, create a new entity which is not scheduler-enabled. $title = "Third - new non-enabled $nonEnabled - Trigger Rule 3"; $this->drupalGet($this->entityAddUrl($entityTypeId, $nonEnabled)); $title = "Third - new non-enabled $nonEnabledBundle - Trigger Rule 3"; $this->drupalGet($this->entityAddUrl($entityTypeId, $nonEnabledBundle)); $this->submitForm(["{$titleField}[0][value]" => $title], 'Save'); $entity = $this->getEntityByTitle($entityTypeId, $title); // Check that rule 3 issued a warning message. Loading @@ -400,11 +386,11 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Fourthly, edit a pre-existing entity which is not enabled for Scheduler, // triggering rule 3. $entity = $this->createEntity($entityTypeId, $nonEnabled, [ "$titleField" => "Fourth - existing non-enabled $nonEnabled", $entity = $this->createEntity($entityTypeId, $nonEnabledBundle, [ "$titleField" => "Fourth - existing non-enabled $nonEnabledBundle", ]); $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabled - Trigger Rule 3"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabledBundle - Trigger Rule 3"], 'Save'); // Check that rule 3 issued a warning message. $assert->pageTextContains('warning message'); $assert->elementExists('xpath', '//div[@aria-label="Warning message" and contains(string(), "Action")]'); Loading @@ -421,7 +407,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Edit the entity again, triggering rule 4. $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabled - Trigger Rule 4"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabledBundle - Trigger Rule 4"], 'Save'); // Check that rule 4 issued a warning message. $assert->pageTextContains('warning message'); $assert->elementExists('xpath', '//div[@aria-label="Warning message" and contains(string(), "Action")]'); Loading scheduler_rules_integration/tests/src/Functional/SchedulerRulesConditionsTest.php +4 −4 Changes for scheduler_rules_integration/tests/src/Functional/SchedulerRulesConditionsTest.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -177,7 +177,7 @@ class SchedulerRulesConditionsTest extends SchedulerBrowserTestBase { $rule5->addCondition("{$condition_prefix}scheduled_for_publishing{$condition_suffix}", ContextConfig::create()->map("$entityTypeId", "$entityTypeId")->negateResult() ); $message5 = 'RULES message 5. This content is not scheduled for publishing.'; $message5 = "RULES message 5. This $entityTypeId is not scheduled for publishing."; $rule5->addAction('rules_system_message', ContextConfig::create() ->setValue('message', $message5) ->setValue('type', 'status') Loading @@ -195,7 +195,7 @@ class SchedulerRulesConditionsTest extends SchedulerBrowserTestBase { $rule6->addCondition("{$condition_prefix}scheduled_for_unpublishing{$condition_suffix}", ContextConfig::create()->map("$entityTypeId", "$entityTypeId")->negateResult() ); $message6 = 'RULES message 6. This content is not scheduled for unpublishing.'; $message6 = "RULES message 6. This $entityTypeId is not scheduled for unpublishing."; $rule6->addAction('rules_system_message', ContextConfig::create() ->setValue('message', $message6) ->setValue('type', 'status') Loading @@ -213,7 +213,7 @@ class SchedulerRulesConditionsTest extends SchedulerBrowserTestBase { $rule7->addCondition("{$condition_prefix}scheduled_for_publishing{$condition_suffix}", ContextConfig::create()->map("$entityTypeId", "$entityTypeId") ); $message7 = 'RULES message 7. This content is scheduled for publishing.'; $message7 = "RULES message 7. This $entityTypeId is scheduled for publishing."; $rule7->addAction('rules_system_message', ContextConfig::create() ->setValue('message', $message7) ->setValue('type', 'status') Loading @@ -231,7 +231,7 @@ class SchedulerRulesConditionsTest extends SchedulerBrowserTestBase { $rule8->addCondition("{$condition_prefix}scheduled_for_unpublishing{$condition_suffix}", ContextConfig::create()->map("$entityTypeId", "$entityTypeId") ); $message8 = 'RULES message 8. This content is scheduled for unpublishing.'; $message8 = "RULES message 8. This $entityTypeId is scheduled for unpublishing."; $rule8->addAction('rules_system_message', ContextConfig::create() ->setValue('message', $message8) ->setValue('type', 'status') Loading scheduler_rules_integration/tests/src/Functional/SchedulerRulesEventsTest.php +4 −4 Changes for scheduler_rules_integration/tests/src/Functional/SchedulerRulesEventsTest.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -127,7 +127,7 @@ class SchedulerRulesEventsTest extends SchedulerBrowserTestBase { public function testRulesEventsNone($entityTypeId, $bundle) { // Add and save an entity without any scheduled dates and check that no // events are triggered. $titleField = ($entityTypeId == 'media') ? 'name' : 'title'; $titleField = $this->titleField($entityTypeId); $title = 'A. Create with no dates'; $this->drupalGet($this->entityAddUrl($entityTypeId, $bundle)); $this->submitForm(["{$titleField}[0][value]" => $title], 'Save'); Loading @@ -152,7 +152,7 @@ class SchedulerRulesEventsTest extends SchedulerBrowserTestBase { // Create an entity with a publish-on date, and check that only event 1 is // triggered. $titleField = ($entityTypeId == 'media') ? 'name' : 'title'; $titleField = $this->titleField($entityTypeId); $title = 'C. Create with publish-on date'; $edit = [ "{$titleField}[0][value]" => $title, Loading Loading @@ -183,7 +183,7 @@ class SchedulerRulesEventsTest extends SchedulerBrowserTestBase { public function testRulesEventsUnpublish($entityTypeId, $bundle) { // Create an entity with an unpublish-on date, and check that only event 4 // is triggered. $titleField = ($entityTypeId == 'media') ? 'name' : 'title'; $titleField = $this->titleField($entityTypeId); $title = 'E. Create with unpublish-on date'; $edit = [ "{$titleField}[0][value]" => $title, Loading Loading @@ -220,7 +220,7 @@ class SchedulerRulesEventsTest extends SchedulerBrowserTestBase { // Create an entity with both publish-on and unpublish-on dates, and check // that both event 1 and event 4 are triggered. $titleField = ($entityTypeId == 'media') ? 'name' : 'title'; $titleField = $this->titleField($entityTypeId); $title = 'G. Create with both dates'; $edit = [ "{$titleField}[0][value]" => $title, Loading src/Annotation/SchedulerPlugin.php +5 −2 Changes for src/Annotation/SchedulerPlugin.php: 5 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -76,8 +76,11 @@ class SchedulerPlugin extends Plugin { /** * The event class for Scheduler events relating to activity on the entity. * * If not specified, it is assumed that the plugin is part of the Scheduler * module and the event class will default to Scheduler's namespace. * This is optional, and if not specified, will default to the standard class * \Drupal\scheduler\Event\Scheduler{EntityType}Events * The class must be in UpperCamelCase with no underscores, so if entityType * contains underscores then this property must be specified. The convention * in this case is to convert each word to upper case and remove underscores. * * @var string */ Loading Loading
.travis.yml +31 −41 Changes for .travis.yml: 31 added lines, 41 removed lines. Original line number Diff line number Diff line Loading @@ -20,46 +20,38 @@ jobs: - php: 7.2 env: - DRUPAL_CORE=8.9.x # 8.9 is slow, 50 mins is the Travis limit, so skip media and product. # Also skip Rules because Typed Data cannot be installed at 8.x. # 8.9 is slow, 50 mins is the Travis limit, so skip all additional # entity types. Also skip Rules because it cannot be installed at 8.x. - MEDIA=NO - PRODUCTS=NO - RULES=NO # ---- Remaining self deprecation notices (0) # ---- Remaining direct deprecation notices (0) - php: 7.4 - php: 7.3 env: - DRUPAL_CORE=9.1.x # ---- Remaining self deprecation notices (3157) # 3144 EventDispatcher (in Rules and Commerce Product module) - NODE=NO - MEDIA=NO # ---- Remaining self deprecation notices (1794) # 1774 EventDispatcher with string event (Rules and Commerce) # 11 Creating an instance of class ... getConnection()->condition() # 7 Symfony\Component\EventDispatcher\Event is deprecated (Rules) # 2 Kernel $modules property must be declared protected # ---- Remaining direct deprecation notices (0) - DEPRECATIONS=3157 - php: 7.4 env: - DRUPAL_CORE=9.1.x # Have a second 9.1 run which excludes the Rules and Products tests. - RULES=NO - PRODUCTS=NO # ---- Remaining self deprecation notices (997) # 995 EventDispatcherInterface::dispatch() # 2 Kernel $modules property must be declared protected # ---- Remaining direct deprecation notices (0) - DEPRECATIONS=997 - DEPRECATIONS=3000 - php: 7.4 env: - DRUPAL_CORE=9.2.x # Exclude Rules and Products tests. - RULES=NO # Exclude Rules, Products and Taxonomy tests. Just run Node and Media. - PRODUCTS=NO # ---- Remaining self deprecation notices (2335) # 1120 Symfony isMasterRequest() is deprecated, use isMainRequest() # 877 EventDispatcherInterface::dispatch() # 336 hook_field_widget_form_alter() in Commerce_product setup. - RULES=NO # ---- Remaining self deprecation notices (2455) # 1174 Symfony isMasterRequest() is deprecated, use isMainRequest() # 927 EventDispatcher with string event (Rules and Commerce) # 352 hook_field_widget_form_alter() in Commerce_product setup. # 2 Kernel $modules property must be declared protected # ---- Remaining direct deprecation notices (0) - DEPRECATIONS=2335 - DEPRECATIONS=2455 # Be sure to cache composer downloads. cache: Loading Loading @@ -136,21 +128,22 @@ before_script: - echo $SYMFONY_DEPRECATIONS_HELPER script: - echo "NODE=$NODE MEDIA=$MEDIA PRODUCTS=$PRODUCTS RULES=$RULES" - EXCLUDE=() - if [ "$NODE" == "NO" ]; then EXCLUDE+=('#node|BasicNode'); fi - if [ "$MEDIA" == "NO" ]; then EXCLUDE+=('#media|BasicMedia'); fi - if [ "$PRODUCTS" == "NO" ]; then EXCLUDE+=('#commerce_product|BasicProduct'); fi - if [ "$RULES" == "NO" ]; then EXCLUDE+=('rules'); fi - EXCLUDE=${EXCLUDE[@]} # create a space delimited string from array # Run the PHPUnit tests. - cd $DRUPAL_ROOT - | if [[ "$MEDIA" == "NO" && "$PRODUCTS" == "NO" && "$RULES" == "NO" ]]; then echo "Running tests excluding Media, Products and Rules ..." ./vendor/bin/phpunit -c ./core/phpunit.xml.dist --debug ./modules/$MODULE/ --filter '/^((?!(media|product|rules)).)*$/i' elif [[ "$MEDIA" == "NO" && "$PRODUCTS" == "NO" ]]; then echo "Running tests excluding Media and Products ..." ./vendor/bin/phpunit -c ./core/phpunit.xml.dist --debug ./modules/$MODULE/ --filter '/^((?!(media|product)).)*$/i' elif [[ "$RULES" == "NO" && "$PRODUCTS" == "NO" ]]; then echo "Running tests excluding Rules and Products ..." ./vendor/bin/phpunit -c ./core/phpunit.xml.dist --debug ./modules/$MODULE/ --filter '/^((?!(rules|product)).)*$/i' elif [ "$RULES" == "NO" ]; then echo "Running tests excluding Rules ..." ./vendor/bin/phpunit -c ./core/phpunit.xml.dist --debug ./modules/$MODULE/ --filter '/^((?!rules).)*$/i' if [ "$EXCLUDE" != "" ]; then echo "Running tests excluding $EXCLUDE ..." export FILTER="/^((?!(${EXCLUDE// /|})).)*$/i" # use parameter expansion to substitute spaces with | echo "FILTER=$FILTER" ./vendor/bin/phpunit -c ./core/phpunit.xml.dist --debug ./modules/$MODULE/ --filter "$FILTER" else echo "Running all tests ..." ./vendor/bin/phpunit -c ./core/phpunit.xml.dist --debug ./modules/$MODULE/ Loading @@ -168,8 +161,5 @@ script: - $DRUPAL_ROOT/vendor/bin/phpcs -i - $DRUPAL_ROOT/vendor/bin/phpcs -e # Show the violations in detail, plus summary and source report. Do not run on # Core 8.8 as there are faults which are fixed using a newer version of Coder. - if [ "$DRUPAL_CORE" != "8.8.x" ]; then $DRUPAL_ROOT/vendor/bin/phpcs . --report-full --report-summary --report-source -s; fi # Show the violations in detail, plus summary and source report. - $DRUPAL_ROOT/vendor/bin/phpcs . --report-full --report-summary --report-source -s;
scheduler_rules_integration/tests/src/Functional/SchedulerRulesActionsTest.php +33 −47 Changes for scheduler_rules_integration/tests/src/Functional/SchedulerRulesActionsTest.php: 33 added lines, 47 removed lines. Original line number Diff line number Diff line Loading @@ -32,28 +32,13 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { } /** * Provides test data. * * @return array * Each array item has the values: * [entity type id, enabled bundle id, non-enabled bundle id]. */ public function dataRulesActions() { $data = [ '#node' => ['node', $this->type, $this->nonSchedulerType], '#media' => ['media', $this->mediaTypeName, $this->nonSchedulerMediaTypeName], '#commerce_product' => ['commerce_product', $this->productTypeName, $this->nonSchedulerProductTypeName], ]; return $data; } /** * Tests the actions which set and remove the 'Publish On' date. * * @dataProvider dataRulesActions() * @dataProvider dataStandardEntityTypes() */ public function testPublishOnActions($entityTypeId, $enabled, $nonEnabled) { public function testPublishOnActions($entityTypeId, $enabledBundle) { $nonEnabledBundle = $this->entityTypeObject($entityTypeId, 'non-enabled')->id(); $titleField = ($entityTypeId == 'media') ? 'name' : 'title'; $publish_on = $this->requestTime + 1800; $publish_on_formatted = $this->dateFormatter->format($publish_on, 'long'); Loading Loading @@ -128,8 +113,8 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { $assert = $this->assertSession(); // First, create a new scheduler-enabled entity, triggering rule 1. $title = "First - new enabled $enabled - Trigger Rule 1"; $this->drupalGet($this->entityAddUrl($entityTypeId, $enabled)); $title = "First - new enabled $enabledBundle - Trigger Rule 1"; $this->drupalGet($this->entityAddUrl($entityTypeId, $enabledBundle)); $this->submitForm(["{$titleField}[0][value]" => $title], 'Save'); $entity = $this->getEntityByTitle($entityTypeId, $title); $this->assertSession()->pageTextContains(sprintf('%s is scheduled to be published %s', $title, $publish_on_formatted)); Loading @@ -144,11 +129,11 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Second, edit a pre-existing Scheduler-enabled entity, without triggering // either of the rules. $entity = $this->createEntity($entityTypeId, $enabled, [ "$titleField" => "Second - existing enabled $enabled", $entity = $this->createEntity($entityTypeId, $enabledBundle, [ "$titleField" => "Second - existing enabled $enabledBundle", ]); $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabled - but no rules will be triggered"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabledBundle - but no rules will be triggered"], 'Save'); $storage->resetCache([$entity->id()]); $entity = $storage->load($entity->id()); // Check that neither of the rules are triggered, no publish and unpublish Loading @@ -161,7 +146,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Edit the entity, triggering rule 1. $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabled - Trigger Rule 1"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabledBundle - Trigger Rule 1"], 'Save'); $storage->resetCache([$entity->id()]); $entity = $storage->load($entity->id()); // Check that rule 1 is triggered and rule 2 is not. Check that a publishing Loading @@ -174,7 +159,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Edit the entity, triggering rule 2. $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabled - Trigger Rule 2"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabledBundle - Trigger Rule 2"], 'Save'); $storage->resetCache([$entity->id()]); $entity = $storage->load($entity->id()); // Check that rule 2 is triggered and rule 1 is not. Check that the Loading @@ -186,8 +171,8 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { $this->assertTrue($entity->isPublished(), 'Entity should be published.'); // Third, create a new entity which is not scheduler-enabled. $title = "Third - new non-enabled $nonEnabled - Trigger Rule 1"; $this->drupalGet($this->entityAddUrl($entityTypeId, $nonEnabled)); $title = "Third - new non-enabled $nonEnabledBundle - Trigger Rule 1"; $this->drupalGet($this->entityAddUrl($entityTypeId, $nonEnabledBundle)); $this->submitForm(["{$titleField}[0][value]" => $title], 'Save'); $entity = $this->getEntityByTitle($entityTypeId, $title); // Check that rule 1 issued a warning message. Loading @@ -206,11 +191,11 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Fourthly, edit a pre-existing entity which is not enabled for Scheduler, // triggering rule 1. $entity = $this->createEntity($entityTypeId, $nonEnabled, [ "$titleField" => "Fourth - existing non-enabled $nonEnabled", $entity = $this->createEntity($entityTypeId, $nonEnabledBundle, [ "$titleField" => "Fourth - existing non-enabled $nonEnabledBundle", ]); $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabled - Trigger Rule 1"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabledBundle - Trigger Rule 1"], 'Save'); // Check that rule 1 issued a warning message. $assert->pageTextContains('warning message'); $assert->elementExists('xpath', '//div[@aria-label="Warning message" and contains(string(), "Action")]'); Loading @@ -227,7 +212,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Edit the entity again, triggering rule 2. $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabled - Trigger Rule 2"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabledBundle - Trigger Rule 2"], 'Save'); // Check that rule 2 issued a warning message. $assert->pageTextContains('warning message'); $assert->elementExists('xpath', '//div[@aria-label="Warning message" and contains(string(), "Action")]'); Loading @@ -245,9 +230,10 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { /** * Tests the actions which set and remove the 'Unpublish On' date. * * @dataProvider dataRulesActions() * @dataProvider dataStandardEntityTypes() */ public function testUnpublishOnActions($entityTypeId, $enabled, $nonEnabled) { public function testUnpublishOnActions($entityTypeId, $enabledBundle) { $nonEnabledBundle = $this->entityTypeObject($entityTypeId, 'non-enabled')->id(); $titleField = ($entityTypeId == 'media') ? 'name' : 'title'; $unpublish_on = $this->requestTime + 2400; $unpublish_on_formatted = $this->dateFormatter->format($unpublish_on, 'long'); Loading Loading @@ -298,7 +284,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { ->setValue('operation', 'contains') ->setValue('value', 'Trigger Rule 4') ); $message4 = 'RULES message 4. Action to remove Unpublish-on date and unpublish the node immediately.'; $message4 = "RULES message 4. Action to remove Unpublish-on date and unpublish the $entityTypeId immediately."; $rule4->addAction("scheduler_remove_unpublishing_date$action_suffix", ContextConfig::create() ->map("$entityTypeId", "$entityTypeId") Loading @@ -322,8 +308,8 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { $assert = $this->assertSession(); // First, create a new scheduler-enabled entity, triggering rule 3. $title = "First - new enabled $enabled - Trigger Rule 3"; $this->drupalGet($this->entityAddUrl($entityTypeId, $enabled)); $title = "First - new enabled $enabledBundle - Trigger Rule 3"; $this->drupalGet($this->entityAddUrl($entityTypeId, $enabledBundle)); $this->submitForm(["{$titleField}[0][value]" => $title], 'Save'); $entity = $this->getEntityByTitle($entityTypeId, $title); $this->assertSession()->pageTextContains(sprintf('%s is scheduled to be unpublished %s', $title, $unpublish_on_formatted)); Loading @@ -338,11 +324,11 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Second, edit a pre-existing Scheduler-enabled entity, without triggering // either of the rules. $entity = $this->createEntity($entityTypeId, $enabled, [ "$titleField" => "Second - existing enabled $enabled", $entity = $this->createEntity($entityTypeId, $enabledBundle, [ "$titleField" => "Second - existing enabled $enabledBundle", ]); $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabled - but no rules will be triggered"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabledBundle - but no rules will be triggered"], 'Save'); $storage->resetCache([$entity->id()]); $entity = $storage->load($entity->id()); // Check that neither of the rules are triggered, no publish and unpublish Loading @@ -355,7 +341,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Edit the entity, triggering rule 3. $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabled - Trigger Rule 3"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabledBundle - Trigger Rule 3"], 'Save'); $storage->resetCache([$entity->id()]); $entity = $storage->load($entity->id()); // Check that rule 3 is triggered and rule 4 is not. Check that an Loading @@ -368,7 +354,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Edit the entity, triggering rule 4. $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabled - Trigger Rule 4"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit enabled $enabledBundle - Trigger Rule 4"], 'Save'); $storage->resetCache([$entity->id()]); $entity = $storage->load($entity->id()); // Check that rule 4 is triggered and rule 3 is not. Check that the Loading @@ -380,8 +366,8 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { $this->assertFalse($entity->isPublished(), 'Entity should be unpublished.'); // Third, create a new entity which is not scheduler-enabled. $title = "Third - new non-enabled $nonEnabled - Trigger Rule 3"; $this->drupalGet($this->entityAddUrl($entityTypeId, $nonEnabled)); $title = "Third - new non-enabled $nonEnabledBundle - Trigger Rule 3"; $this->drupalGet($this->entityAddUrl($entityTypeId, $nonEnabledBundle)); $this->submitForm(["{$titleField}[0][value]" => $title], 'Save'); $entity = $this->getEntityByTitle($entityTypeId, $title); // Check that rule 3 issued a warning message. Loading @@ -400,11 +386,11 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Fourthly, edit a pre-existing entity which is not enabled for Scheduler, // triggering rule 3. $entity = $this->createEntity($entityTypeId, $nonEnabled, [ "$titleField" => "Fourth - existing non-enabled $nonEnabled", $entity = $this->createEntity($entityTypeId, $nonEnabledBundle, [ "$titleField" => "Fourth - existing non-enabled $nonEnabledBundle", ]); $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabled - Trigger Rule 3"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabledBundle - Trigger Rule 3"], 'Save'); // Check that rule 3 issued a warning message. $assert->pageTextContains('warning message'); $assert->elementExists('xpath', '//div[@aria-label="Warning message" and contains(string(), "Action")]'); Loading @@ -421,7 +407,7 @@ class SchedulerRulesActionsTest extends SchedulerBrowserTestBase { // Edit the entity again, triggering rule 4. $this->drupalGet($entity->toUrl('edit-form')); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabled - Trigger Rule 4"], 'Save'); $this->submitForm(["{$titleField}[0][value]" => "Edit non-enabled $nonEnabledBundle - Trigger Rule 4"], 'Save'); // Check that rule 4 issued a warning message. $assert->pageTextContains('warning message'); $assert->elementExists('xpath', '//div[@aria-label="Warning message" and contains(string(), "Action")]'); Loading
scheduler_rules_integration/tests/src/Functional/SchedulerRulesConditionsTest.php +4 −4 Changes for scheduler_rules_integration/tests/src/Functional/SchedulerRulesConditionsTest.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -177,7 +177,7 @@ class SchedulerRulesConditionsTest extends SchedulerBrowserTestBase { $rule5->addCondition("{$condition_prefix}scheduled_for_publishing{$condition_suffix}", ContextConfig::create()->map("$entityTypeId", "$entityTypeId")->negateResult() ); $message5 = 'RULES message 5. This content is not scheduled for publishing.'; $message5 = "RULES message 5. This $entityTypeId is not scheduled for publishing."; $rule5->addAction('rules_system_message', ContextConfig::create() ->setValue('message', $message5) ->setValue('type', 'status') Loading @@ -195,7 +195,7 @@ class SchedulerRulesConditionsTest extends SchedulerBrowserTestBase { $rule6->addCondition("{$condition_prefix}scheduled_for_unpublishing{$condition_suffix}", ContextConfig::create()->map("$entityTypeId", "$entityTypeId")->negateResult() ); $message6 = 'RULES message 6. This content is not scheduled for unpublishing.'; $message6 = "RULES message 6. This $entityTypeId is not scheduled for unpublishing."; $rule6->addAction('rules_system_message', ContextConfig::create() ->setValue('message', $message6) ->setValue('type', 'status') Loading @@ -213,7 +213,7 @@ class SchedulerRulesConditionsTest extends SchedulerBrowserTestBase { $rule7->addCondition("{$condition_prefix}scheduled_for_publishing{$condition_suffix}", ContextConfig::create()->map("$entityTypeId", "$entityTypeId") ); $message7 = 'RULES message 7. This content is scheduled for publishing.'; $message7 = "RULES message 7. This $entityTypeId is scheduled for publishing."; $rule7->addAction('rules_system_message', ContextConfig::create() ->setValue('message', $message7) ->setValue('type', 'status') Loading @@ -231,7 +231,7 @@ class SchedulerRulesConditionsTest extends SchedulerBrowserTestBase { $rule8->addCondition("{$condition_prefix}scheduled_for_unpublishing{$condition_suffix}", ContextConfig::create()->map("$entityTypeId", "$entityTypeId") ); $message8 = 'RULES message 8. This content is scheduled for unpublishing.'; $message8 = "RULES message 8. This $entityTypeId is scheduled for unpublishing."; $rule8->addAction('rules_system_message', ContextConfig::create() ->setValue('message', $message8) ->setValue('type', 'status') Loading
scheduler_rules_integration/tests/src/Functional/SchedulerRulesEventsTest.php +4 −4 Changes for scheduler_rules_integration/tests/src/Functional/SchedulerRulesEventsTest.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -127,7 +127,7 @@ class SchedulerRulesEventsTest extends SchedulerBrowserTestBase { public function testRulesEventsNone($entityTypeId, $bundle) { // Add and save an entity without any scheduled dates and check that no // events are triggered. $titleField = ($entityTypeId == 'media') ? 'name' : 'title'; $titleField = $this->titleField($entityTypeId); $title = 'A. Create with no dates'; $this->drupalGet($this->entityAddUrl($entityTypeId, $bundle)); $this->submitForm(["{$titleField}[0][value]" => $title], 'Save'); Loading @@ -152,7 +152,7 @@ class SchedulerRulesEventsTest extends SchedulerBrowserTestBase { // Create an entity with a publish-on date, and check that only event 1 is // triggered. $titleField = ($entityTypeId == 'media') ? 'name' : 'title'; $titleField = $this->titleField($entityTypeId); $title = 'C. Create with publish-on date'; $edit = [ "{$titleField}[0][value]" => $title, Loading Loading @@ -183,7 +183,7 @@ class SchedulerRulesEventsTest extends SchedulerBrowserTestBase { public function testRulesEventsUnpublish($entityTypeId, $bundle) { // Create an entity with an unpublish-on date, and check that only event 4 // is triggered. $titleField = ($entityTypeId == 'media') ? 'name' : 'title'; $titleField = $this->titleField($entityTypeId); $title = 'E. Create with unpublish-on date'; $edit = [ "{$titleField}[0][value]" => $title, Loading Loading @@ -220,7 +220,7 @@ class SchedulerRulesEventsTest extends SchedulerBrowserTestBase { // Create an entity with both publish-on and unpublish-on dates, and check // that both event 1 and event 4 are triggered. $titleField = ($entityTypeId == 'media') ? 'name' : 'title'; $titleField = $this->titleField($entityTypeId); $title = 'G. Create with both dates'; $edit = [ "{$titleField}[0][value]" => $title, Loading
src/Annotation/SchedulerPlugin.php +5 −2 Changes for src/Annotation/SchedulerPlugin.php: 5 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -76,8 +76,11 @@ class SchedulerPlugin extends Plugin { /** * The event class for Scheduler events relating to activity on the entity. * * If not specified, it is assumed that the plugin is part of the Scheduler * module and the event class will default to Scheduler's namespace. * This is optional, and if not specified, will default to the standard class * \Drupal\scheduler\Event\Scheduler{EntityType}Events * The class must be in UpperCamelCase with no underscores, so if entityType * contains underscores then this property must be specified. The convention * in this case is to convert each word to upper case and remove underscores. * * @var string */ Loading