UrlParserTest
extends UnitTest
in package
Used to test that the UrlParser class. For now, want to see that the method canonicalLink is working correctly and that isPathMemberRegexPaths (used in robot_processor.php) works
Tags
Table of Contents
- case_name = "TestCase"
- The suffix that all TestCase methods need to have to be called by run()
- $current_method : string
- Contains the value of the next test case to be run can be used by setUp
- $test_case_results : array<string|int, mixed>
- Used to store the results for each test sub case
- $test_objects : array<string|int, mixed>
- Used to hold objects to be used in tests
- __construct() : mixed
- Constructor should be overridden to do any set up that occurs before and test cases
- assertEqual() : mixed
- Checks that $x and $y are the same, the result of the test is added to $this->test_case_results
- assertFalse() : mixed
- Checks that $x can coerced to false, the result of the test is added to $this->test_case_results
- assertNotEqual() : mixed
- Checks that $x and $y are not the same, the result of the test is added to $this->test_case_results
- assertTrue() : mixed
- Checks that $x can coerced to true, the result of the test is added to $this->test_case_results
- canonicalLinkTestCase() : mixed
- Check if can go from a relative link, base link to a complete link in various different ways
- cullByDomainFilterTestCase() : mixed
- Checks if cullByDomainFilter is working okay. Only works if there is a BloomFilterFile called C\WORK_DIRECTORY .
- getCompanyLevelDomainTestCase() : mixed
- Checks if getCompanyLevelDomain is working okay
- getHostTestCase() : mixed
- Checks if getHost is working okay
- getSchemeTestCase() : mixed
- Checks if getScheme is working okay
- isPathMemberRegexPathsTestCase() : mixed
- Check is a path matches with a list of paths presumably coming from a robots.txt file
- run() : array<string|int, mixed>
- Execute each of the test cases of this unit test and return the results
- setUp() : mixed
- UrlParser uses static methods so doesn't do anything right now
- simplifyUrlTestCase() : mixed
- Tests simplifyUrl function used on SERP pages
- tearDown() : mixed
- UrlParser uses static methods so doesn't do anything right now
- urlMemberSiteArrayTestCase() : mixed
- urlMemberSiteArray is a function called by both allowedToCrawlSite disallowedToCrawlSite to test if a url belongs to alist of regex's of urls or domain. This test function tests this functionality
Constants
case_name
The suffix that all TestCase methods need to have to be called by run()
public
mixed
case_name
= "TestCase"
Properties
$current_method
Contains the value of the next test case to be run can be used by setUp
public
string
$current_method
$test_case_results
Used to store the results for each test sub case
public
array<string|int, mixed>
$test_case_results
$test_objects
Used to hold objects to be used in tests
public
array<string|int, mixed>
$test_objects
Methods
__construct()
Constructor should be overridden to do any set up that occurs before and test cases
public
__construct() : mixed
Return values
mixed —assertEqual()
Checks that $x and $y are the same, the result of the test is added to $this->test_case_results
public
assertEqual(mixed $x, mixed $y[, string $description = "" ]) : mixed
Parameters
- $x : mixed
-
a first item to compare
- $y : mixed
-
a second item to compare
- $description : string = ""
-
information about this test subcase
Return values
mixed —assertFalse()
Checks that $x can coerced to false, the result of the test is added to $this->test_case_results
public
assertFalse(mixed $x[, string $description = "" ]) : mixed
Parameters
- $x : mixed
-
item to check
- $description : string = ""
-
information about this test subcase
Return values
mixed —assertNotEqual()
Checks that $x and $y are not the same, the result of the test is added to $this->test_case_results
public
assertNotEqual(mixed $x, mixed $y[, string $description = "" ]) : mixed
Parameters
- $x : mixed
-
a first item to compare
- $y : mixed
-
a second item to compare
- $description : string = ""
-
information about this test subcase
Return values
mixed —assertTrue()
Checks that $x can coerced to true, the result of the test is added to $this->test_case_results
public
assertTrue(mixed $x[, string $description = "" ]) : mixed
Parameters
- $x : mixed
-
item to check
- $description : string = ""
-
information about this test subcase
Return values
mixed —canonicalLinkTestCase()
Check if can go from a relative link, base link to a complete link in various different ways
public
canonicalLinkTestCase() : mixed
Return values
mixed —cullByDomainFilterTestCase()
Checks if cullByDomainFilter is working okay. Only works if there is a BloomFilterFile called C\WORK_DIRECTORY .
public
cullByDomainFilterTestCase() : mixed
"/data/domain_filters/top10000000.ftr" that at least contains yahoo.com
Return values
mixed —getCompanyLevelDomainTestCase()
Checks if getCompanyLevelDomain is working okay
public
getCompanyLevelDomainTestCase() : mixed
Return values
mixed —getHostTestCase()
Checks if getHost is working okay
public
getHostTestCase() : mixed
Return values
mixed —getSchemeTestCase()
Checks if getScheme is working okay
public
getSchemeTestCase() : mixed
Return values
mixed —isPathMemberRegexPathsTestCase()
Check is a path matches with a list of paths presumably coming from a robots.txt file
public
isPathMemberRegexPathsTestCase() : mixed
Return values
mixed —run()
Execute each of the test cases of this unit test and return the results
public
run([string $method = null ]) : array<string|int, mixed>
Parameters
- $method : string = null
-
if not null then the method to run, else run all methods
Return values
array<string|int, mixed> —test case results
setUp()
UrlParser uses static methods so doesn't do anything right now
public
setUp() : mixed
Return values
mixed —simplifyUrlTestCase()
Tests simplifyUrl function used on SERP pages
public
simplifyUrlTestCase() : mixed
Return values
mixed —tearDown()
UrlParser uses static methods so doesn't do anything right now
public
tearDown() : mixed
Return values
mixed —urlMemberSiteArrayTestCase()
urlMemberSiteArray is a function called by both allowedToCrawlSite disallowedToCrawlSite to test if a url belongs to alist of regex's of urls or domain. This test function tests this functionality
public
urlMemberSiteArrayTestCase() : mixed