From 13de13ba29846b28b0b35c4eff70402e1ddbded2 Mon Sep 17 00:00:00 2001
From: Florent Torregrosa <florent.torregrosa@gmail.com>
Date: Thu, 14 May 2015 14:17:58 +0200
Subject: [PATCH] Debugging testbot.

---
 tests/protected_node.fork.test | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/tests/protected_node.fork.test b/tests/protected_node.fork.test
index c2c3261..2749427 100644
--- a/tests/protected_node.fork.test
+++ b/tests/protected_node.fork.test
@@ -77,7 +77,6 @@ class ProtectedNodeFork extends ProtectedNodeBaseTestCase {
    *
    * Test that the user is redirected to the node with the matching password.
    */
-  /**
   public function testMatchingPassword() {
     // Log in as Admin.
     $this->drupalLogin($this->adminUser);
@@ -91,7 +90,7 @@ class ProtectedNodeFork extends ProtectedNodeBaseTestCase {
     $this->drupalLogout();
 
     // Prepare protected_pages parameter.
-    $protected_pages = implode(',', array($node1->nid, $node2->nid));
+    $protected_pages = implode(',', array($node2->nid, $node1->nid));
 
     // Access to node1.
     $this->drupalLogin($this->normalAccessAllowedUser);
@@ -109,10 +108,25 @@ class ProtectedNodeFork extends ProtectedNodeBaseTestCase {
     $this->drupalLogin($this->normalAccessAllowedUser);
     $form = array('password' => $password2);
     $this->drupalPost('protected-nodes', $form, t('OK'), array('query' => array('protected_pages' => $protected_pages)));
+    $node_title = $node2->title;
     $text = $node2->body[LANGUAGE_NONE][0]['value'];
-    $this->assertText($text, "User with right permission is redirected to a protected node with right password", $this->group);
+    $page_title = $this->xpath("//h1[@class=:class and @id=:id]", array(':class' => 'title', ':id' => 'page-title'));
+    $page_title = $page_title[0]->__toString();
+    $page_title = trim($page_title);
+
+    $query_parameters = drupal_get_query_parameters();
+    $parameters = '';
+    foreach ($query_parameters as $key => $value) {
+      $parameters .= "$key => $value";
+    }
+
+    $args = implode(', ', arg());
+
+
+    $this->assertEqual($node_title, $page_title, "query parameters: $query_parameters. args: $args.", $this->group);
+    $this->assertEqual($node_title, $page_title, "Node title: $node_title. Xpath found title: $page_title. Node nid: $node2->nid.", $this->group);
+    $this->assertText($text, "the user has arrived to node 2.", $this->group);
   }
-   */
 
   /**
    * Test function.
-- 
2.1.4

