[ Index ]

PHP Cross Reference of YOURLS




/tests/tests/http/ -> api-check.php (summary)

(no description)

File Size: 520 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

HTTP_AYO_Tests:: (25 methods):

Class: HTTP_AYO_Tests  - X-Ref

HTTP functions related to api.yourls.org

setUp()   X-Ref
No description

tearDown()   X-Ref
No description

fake_http_request_success()   X-Ref
Emulate successful HTTP request to api.yourls.org

fake_http_request_failure()   X-Ref
Emulate failed HTTP request to api.yourls.org

fake_http_request_server_error()   X-Ref
Emulate HTTP request to api.yourls.org with a server error

test_api_failed_request()   X-Ref
Check that version checking returns false if host is unreachable, and that failed attempts counter increments

test_api_failed_request_server_error()   X-Ref
Check that version checking returns false if host errors, and that failed attempts counter increments

check_and_assert()   X-Ref
Helper function for test_api_failed_request() and test_api_failed_request_server_error()

test_check_core_version()   X-Ref
Check that version checking returns expected stuff and updates the relevant option

since: 0.1

test_check_only_in_admin()   X-Ref
Check that version checking happens only when visiting the admin area

since: 0.1

return_case_object( $failed_attempts, $last_attempt, $version_checked )   X-Ref
Generate an object to mock last attempt of checking against api.yourls.org

case_scenario()   X-Ref
Provider of various test cases for test_api_check_in_various_scenario()

test_api_check_in_various_scenario( $name, $checks, $expected )   X-Ref
Check if we should poll api.yourls.org under various circumstances

since: 0.1

json_responses()   X-Ref
Provide fake JSON responses from api.yourls.org and a boolean stating if they should be accepted or not

test_validate_api_json_response($json, $expected)   X-Ref
Validate various json responses from api.yourls.org and make sure they're legit

since: 0.1

fake_and_true_github_repo_urls()   X-Ref
Provide fake and true github repo URLs

test_is_valid_github_repo_url($url, $expected)   X-Ref
Test yourls_is_valid_github_repo_url()

new_version_scenarios()   X-Ref
Provide various scenarios for version reported by api.yourls.org / current version to check if notice is shown

test_new_version_notice( $api_version, $current_version, $expected )   X-Ref
Test various YOURLS version strings from api.yourls.org, compare them to the actual version
and make sure we display the correct update notice

various_zipball_url_version()   X-Ref
Test various zipball URLs and get version number from it

test_get_version_from_zipball_url($url, $expected)   X-Ref
Test various zipball URLs and get version number from it

get_various_json_response_keys()   X-Ref
test various core version JSON responses from api.yourls.org

test_yourls_validate_core_version_response_keys($json, $expected)   X-Ref
Check yourls_validate_core_version_response_keys() works as expected

get_api_yourls_core()   X-Ref
Return all possible api.yourls.org/core/version URL

test_yourls_get_core_version_json($url)   X-Ref
Make sure https://api.yourls.org/core/version/1.[0/1]/ returns a valid JSON response

This test may fail is the server is unreachable or the API is down.
TODO: make this test evolve as the API evolves

Generated: Wed Sep 28 05:10:02 2022 Cross-referenced by PHPXref 0.7.1