Mercurial > hg > isophonics-drupal-site
comparison core/modules/update/tests/src/Functional/UpdateContribTest.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
176 // Instead of just searching for 'BBB Update test' or something, we want | 176 // Instead of just searching for 'BBB Update test' or something, we want |
177 // to use the full markup that starts the project entry itself, so that | 177 // to use the full markup that starts the project entry itself, so that |
178 // we're really testing that the project listings are in the right order. | 178 // we're really testing that the project listings are in the right order. |
179 $bbb_project_link = '<div class="project-update__title"><a href="http://example.com/project/bbb_update_test">BBB Update test</a>'; | 179 $bbb_project_link = '<div class="project-update__title"><a href="http://example.com/project/bbb_update_test">BBB Update test</a>'; |
180 $ccc_project_link = '<div class="project-update__title"><a href="http://example.com/project/ccc_update_test">CCC Update test</a>'; | 180 $ccc_project_link = '<div class="project-update__title"><a href="http://example.com/project/ccc_update_test">CCC Update test</a>'; |
181 $this->assertTrue(strpos($this->getRawContent(), $bbb_project_link) < strpos($this->getRawContent(), $ccc_project_link), "'BBB Update test' project is listed before the 'CCC Update test' project"); | 181 $this->assertTrue(strpos($this->getSession()->getPage()->getContent(), $bbb_project_link) < strpos($this->getSession()->getPage()->getContent(), $ccc_project_link), "'BBB Update test' project is listed before the 'CCC Update test' project"); |
182 } | 182 } |
183 | 183 |
184 /** | 184 /** |
185 * Tests that subthemes are notified about security updates for base themes. | 185 * Tests that subthemes are notified about security updates for base themes. |
186 */ | 186 */ |
436 $update_test_config->set('update_status', [])->save(); | 436 $update_test_config->set('update_status', [])->save(); |
437 $this->drupalGet('admin/modules/update'); | 437 $this->drupalGet('admin/modules/update'); |
438 $this->assertNoText(t('Security update')); | 438 $this->assertNoText(t('Security update')); |
439 } | 439 } |
440 | 440 |
441 /** | |
442 * Tests update status of security releases. | |
443 * | |
444 * @param string $module_version | |
445 * The module version the site is using. | |
446 * @param string[] $expected_security_releases | |
447 * The security releases, if any, that the status report should recommend. | |
448 * @param string $expected_update_message_type | |
449 * The type of update message expected. | |
450 * @param string $fixture | |
451 * The fixture file to use. | |
452 * | |
453 * @dataProvider securityUpdateAvailabilityProvider | |
454 */ | |
455 public function testSecurityUpdateAvailability($module_version, array $expected_security_releases, $expected_update_message_type, $fixture) { | |
456 $system_info = [ | |
457 '#all' => [ | |
458 'version' => '8.0.0', | |
459 ], | |
460 'aaa_update_test' => [ | |
461 'project' => 'aaa_update_test', | |
462 'version' => $module_version, | |
463 'hidden' => FALSE, | |
464 ], | |
465 ]; | |
466 $this->config('update_test.settings')->set('system_info', $system_info)->save(); | |
467 $this->refreshUpdateStatus(['drupal' => '0.0', 'aaa_update_test' => $fixture]); | |
468 $this->assertSecurityUpdates('aaa_update_test', $expected_security_releases, $expected_update_message_type, 'table.update:nth-of-type(2)'); | |
469 } | |
470 | |
471 /** | |
472 * Data provider method for testSecurityUpdateAvailability(). | |
473 * | |
474 * These test cases rely on the following fixtures containing the following | |
475 * releases: | |
476 * - aaa_update_test.sec.8.x-1.2.xml | |
477 * - 8.x-1.2 Security update | |
478 * - 8.x-1.1 Insecure | |
479 * - 8.x-1.0 Insecure | |
480 * - aaa_update_test.sec.8.x-1.1_8.x-1.2.xml | |
481 * - 8.x-1.2 Security update | |
482 * - 8.x-1.1 Security update, Insecure | |
483 * - 8.x-1.0 Insecure | |
484 * - aaa_update_test.sec.8.x-1.2_8.x-2.2.xml | |
485 * - 8.x-3.0-beta2 | |
486 * - 8.x-3.0-beta1 Insecure | |
487 * - 8.x-2.2 Security update | |
488 * - 8.x-2.1 Security update, Insecure | |
489 * - 8.x-2.0 Insecure | |
490 * - 8.x-1.2 Security update | |
491 * - 8.x-1.1 Insecure | |
492 * - 8.x-1.0 Insecure | |
493 * - aaa_update_test.sec.8.x-2.2_1.x_secure.xml | |
494 * - 8.x-2.2 Security update | |
495 * - 8.x-2.1 Security update, Insecure | |
496 * - 8.x-2.0 Insecure | |
497 * - 8.x-1.2 | |
498 * - 8.x-1.1 | |
499 * - 8.x-1.0 | |
500 */ | |
501 public function securityUpdateAvailabilityProvider() { | |
502 return [ | |
503 // Security releases available for module major release 1. | |
504 // No releases for next major. | |
505 '8.x-1.0, 8.x-1.2' => [ | |
506 'module_patch_version' => '8.x-1.0', | |
507 'expected_security_releases' => ['8.x-1.2'], | |
508 'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED, | |
509 'fixture' => 'sec.8.x-1.2', | |
510 ], | |
511 // Two security releases available for module major release 1. | |
512 // 8.x-1.1 security release marked as insecure. | |
513 // No releases for next major. | |
514 '8.x-1.0, 8.x-1.1 8.x-1.2' => [ | |
515 'module_patch_version' => '8.x-1.0', | |
516 'expected_security_releases' => ['8.x-1.2'], | |
517 'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED, | |
518 'fixture' => 'sec.8.x-1.1_8.x-1.2', | |
519 ], | |
520 // Security release available for module major release 2. | |
521 // No releases for next major. | |
522 '8.x-2.0, 8.x-2.2' => [ | |
523 'module_patch_version' => '8.x-2.0', | |
524 'expected_security_releases' => ['8.x-2.2'], | |
525 'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED, | |
526 'fixture' => 'sec.8.x-2.2_1.x_secure', | |
527 ], | |
528 '8.x-2.2, 8.x-1.2 8.x-2.2' => [ | |
529 'module_patch_version' => '8.x-2.2', | |
530 'expected_security_releases' => [], | |
531 'expected_update_message_type' => static::UPDATE_NONE, | |
532 'fixture' => 'sec.8.x-1.2_8.x-2.2', | |
533 ], | |
534 // Security release available for module major release 1. | |
535 // Security release also available for next major. | |
536 '8.x-1.0, 8.x-1.2 8.x-2.2' => [ | |
537 'module_patch_version' => '8.x-1.0', | |
538 'expected_security_releases' => ['8.x-1.2'], | |
539 'expected_update_message_type' => static::SECURITY_UPDATE_REQUIRED, | |
540 'fixture' => 'sec.8.x-1.2_8.x-2.2', | |
541 ], | |
542 // No security release available for module major release 1 but 1.x | |
543 // releases are not marked as insecure. | |
544 // Security release available for next major. | |
545 '8.x-1.0, 8.x-2.2, not insecure' => [ | |
546 'module_patch_version' => '8.x-1.0', | |
547 'expected_security_releases' => [], | |
548 'expected_update_message_type' => static::UPDATE_AVAILABLE, | |
549 'fixture' => 'sec.8.x-2.2_1.x_secure', | |
550 ], | |
551 // On latest security release for module major release 1. | |
552 // Security release also available for next major. | |
553 '8.x-1.2, 8.x-1.2 8.x-2.2' => [ | |
554 'module_patch_version' => '8.x-1.2', | |
555 'expected_security_release' => [], | |
556 'expected_update_message_type' => static::UPDATE_NONE, | |
557 'fixture' => 'sec.8.x-1.2_8.x-2.2', | |
558 ], | |
559 // @todo In https://www.drupal.org/node/2865920 add test cases: | |
560 // - 8.x-2.0 using fixture 'sec.8.x-1.2_8.x-2.2' to ensure that 8.x-2.2 | |
561 // is the only security update. | |
562 // - 8.x-3.0-beta1 using fixture 'sec.8.x-1.2_8.x-2.2' to ensure that | |
563 // 8.x-2.2 is the only security update. | |
564 ]; | |
565 } | |
566 | |
441 } | 567 } |