Skip to content
Snippets Groups Projects
Commit bcfecbbf authored by catch's avatar catch
Browse files

Issue #3131900 by mondrake, longwave, xjm, alexpott: Refactor assertions that...

Issue #3131900 by mondrake, longwave, xjm, alexpott: Refactor assertions that assign return values to variables
parent 58a4457b
No related branches found
No related tags found
17 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1896Issue #2940605: Can only intentionally re-render an entity with references 20 times,!1101Issue #2412669 by claudiu.cristea, Julfabre, sidharrell, catch, daffie,...,!1039Issue #2556069 by claudiu.cristea, bnjmnm, lauriii, pfrenssen, Tim Bozeman,...,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!1012Issue #3226887: Hreflang on non-canonical content pages,!872Draft: Issue #3221319: Race condition when creating menu links and editing content deletes menu links,!594Put each entity type table into a details element on admin/config/regional/content-language,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!512Issue #3207771: Menu UI node type form documentation points to non-existent function,!485Sets the autocomplete attribute for username/password input field on login form.,!449Issue #2784233: Allow multiple vocabularies in the taxonomy filter,!231Issue #2671162: summary text wysiwyg patch working fine on 9.2.0-dev,!43Resolve #3173180: Add UI for 'loading' html attribute to images,!30Issue #3182188: Updates composer usage to point at ./vendor/bin/composer
......@@ -125,7 +125,7 @@ protected function assertCacheTags(array $expected_tags, $include_default_tags =
* (optional) Whether the default contexts should automatically be included.
*
* @return bool
* TRUE if the assertion succeeded, FALSE otherwise.
* Always returns TRUE.
*/
protected function assertCacheContexts(array $expected_contexts, $message = NULL, $include_default_contexts = TRUE) {
if ($include_default_contexts) {
......@@ -142,7 +142,7 @@ protected function assertCacheContexts(array $expected_contexts, $message = NULL
sort($expected_contexts);
sort($actual_contexts);
$this->assertSame($expected_contexts, $actual_contexts, $message ?? '');
return $actual_contexts === $expected_contexts;
return TRUE;
}
/**
......
......@@ -72,8 +72,7 @@ public function testSessionSaveRegenerate() {
$this->drupalGet('user/login');
$this->submitForm($edit, 'Log in');
$this->drupalGet('user');
$pass = $this->assertSession()->pageTextContains($user->getAccountName());
$this->_logged_in = $pass;
$this->assertSession()->pageTextContains($user->getAccountName());
$this->drupalGet('session-test/id');
$matches = [];
......
......@@ -107,9 +107,6 @@ public function testToolbarCacheContextsCaller() {
* Expected cache contexts for both users.
* @param string $message
* (optional) A verbose message to output.
*
* @return
* TRUE if the assertion succeeded, FALSE otherwise.
*/
protected function assertToolbarCacheContexts(array $cache_contexts, $message = NULL) {
// Default cache contexts that should exist on all test cases.
......@@ -123,16 +120,13 @@ protected function assertToolbarCacheContexts(array $cache_contexts, $message =
// Assert contexts for user1 which has only default permissions.
$this->drupalLogin($this->adminUser);
$this->drupalGet('test-page');
$return = $this->assertCacheContexts($cache_contexts);
$this->assertCacheContexts($cache_contexts, $message);
$this->drupalLogout();
// Assert contexts for user2 which has some additional permissions.
$this->drupalLogin($this->adminUser2);
$this->drupalGet('test-page');
$return = $return && $this->assertCacheContexts($cache_contexts);
$this->assertTrue($return, $message);
return $return;
$this->assertCacheContexts($cache_contexts, $message);
}
/**
......
......@@ -160,9 +160,6 @@ public function testPagePaths() {
*
* @param string $path
* Path that will be set as the view page display path.
*
* @return bool
* Assertion result.
*/
public function assertPagePath($path) {
$view = Views::getView('test_page_display_path');
......@@ -172,10 +169,10 @@ public function assertPagePath($path) {
$this->container->get('router.builder')->rebuild();
// Check if we successfully changed the path.
$this->drupalGet($path);
$success = $this->assertSession()->statusCodeEquals(200);
$this->assertSession()->statusCodeEquals(200);
// Check if we don't get any error on the view edit page.
$this->drupalGet('admin/structure/views/view/test_page_display_path');
return $success && $this->assertSession()->statusCodeEquals(200);
$this->assertSession()->statusCodeEquals(200);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment