You are here

function SearchByPageUnitTest::testPathParts in Search by Page 6

Same name and namespace in other branches
  1. 7 tests/search_by_page.test \SearchByPageUnitTest::testPathParts()

Tests the search_by_page_path_parts() function.

File

tests/search_by_page.test, line 30
Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com

Class

SearchByPageUnitTest
Unit tests for Search by Page functions.

Code

function testPathParts() {
  $path = "abc/def?a=b&c=f";
  $res = search_by_page_path_parts($path);
  $this
    ->assertEqual(count($res), 2, "search_by_page_path_parts() returns right count in results");
  $this
    ->assertEqual($res[0], 'abc/def', "search_by_page_path_parts() returns right base path");
  $this
    ->assertEqual($res[1], 'a=b&c=f', "search_by_page_path_parts() returns right query part");
  $path = "abc/def";
  $res = search_by_page_path_parts($path);
  $this
    ->assertEqual(count($res), 1, "search_by_page_path_parts() returns right count in results");
  $this
    ->assertEqual($res[0], 'abc/def', "search_by_page_path_parts() returns right base path");
  $path = "abc/def&a=b&c=f";
  $res = search_by_page_path_parts($path);
  $this
    ->assertEqual(count($res), 2, "search_by_page_path_parts() returns right count in results");
  $this
    ->assertEqual($res[0], 'abc/def', "search_by_page_path_parts() returns right base path");
  $this
    ->assertEqual($res[1], 'a=b&c=f', "search_by_page_path_parts() returns right query part");
}