Yioop_V9.5_Source_Code_Documentation

WebArchiveTest extends UnitTest
in package

UnitTest for the WebArchive class. A web archive is used to store array-based objects persistently to a file. This class tests storing and retrieving from such an archive.

Tags
author

Chris Pollett

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
addObjectTestCase()  : mixed
Inserts three objects into a web archive. To look up an object in a web archive we need to know its byte offset into the archive file. This test looks that after the inserts we get back an array of byte offsets and that the byte offsets are of increasing size
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
getObjectTestCase()  : mixed
Does two addObjects of three objects each. Then does a getObjects to get six object using offset 0 into the web archive. This should return the six objects just inserted
reloadArchiveTestCase()  : mixed
If the file associated with a web archive already exists when the constructor is called, then the constructor will load the existing web archive. This test case checks this functionality by adding six items to a web archive, then constructing a new WebArchive object using the same file name and seeing if we can read the objects that were just inserted.
run()  : array<string|int, mixed>
Execute each of the test cases of this unit test and return the results
setUp()  : mixed
Creates a new web archive object that we can add objects to
tearDown()  : mixed
Delete any files associated with out test web archive

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

addObjectTestCase()

Inserts three objects into a web archive. To look up an object in a web archive we need to know its byte offset into the archive file. This test looks that after the inserts we get back an array of byte offsets and that the byte offsets are of increasing size

public addObjectTestCase() : 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

getObjectTestCase()

Does two addObjects of three objects each. Then does a getObjects to get six object using offset 0 into the web archive. This should return the six objects just inserted

public getObjectTestCase() : mixed
Return values
mixed

reloadArchiveTestCase()

If the file associated with a web archive already exists when the constructor is called, then the constructor will load the existing web archive. This test case checks this functionality by adding six items to a web archive, then constructing a new WebArchive object using the same file name and seeing if we can read the objects that were just inserted.

public reloadArchiveTestCase() : 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()

Creates a new web archive object that we can add objects to

public setUp() : mixed
Return values
mixed

tearDown()

Delete any files associated with out test web archive

public tearDown() : mixed
Return values
mixed

        

Search results