PackedTableToolsTest
extends UnitTest
in package
Used to test the PackedTableTools class. PackedTableTools are used for reading and storing rows with respect to some signature
Table of Contents
- case_name = "TestCase"
- The suffix that all TestCase methods need to have to be called by run()
- TEST_DIR = \seekquarry\yioop\configs\TEST_DIR . '/test_files/packed_test'
- Prefix of folders for testing PackedTable's
- $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
- checkPackUnpackTableRows() : mixed
- Auxiliary function used during test that takes a PackedTableTools object instantiated according to some row signature and an array rows in that signature and checks that for all rows packing the row followed by unpacking it returns the original row. IF a row fails a testCase message is output
- packUnpackMultiRowTestCase() : mixed
- This tests packing and unpacking rows according to a PackedTableTools signature in the case that where more than one record can be associated with the primary key (clustering).
- packUnpackSingleRowTestCase() : mixed
- This tests packing and unpacking rows according to a PackedTableTools signature in the case that there is only one record associated with the primary key (no-clustering).
- run() : array<string|int, mixed>
- Execute each of the test cases of this unit test and return the results
- saveAddLoadTestCase() : mixed
- This tests if a set of rows packed according to a PackedTableTools record is saved that it can be reloaded and unpacked and still get the same results
- setUp() : mixed
- Creates test directory for the tests
- tearDown() : mixed
- After the tests delete test directory
Constants
case_name
The suffix that all TestCase methods need to have to be called by run()
public
mixed
case_name
= "TestCase"
TEST_DIR
Prefix of folders for testing PackedTable's
public
mixed
TEST_DIR
= \seekquarry\yioop\configs\TEST_DIR . '/test_files/packed_test'
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 —checkPackUnpackTableRows()
Auxiliary function used during test that takes a PackedTableTools object instantiated according to some row signature and an array rows in that signature and checks that for all rows packing the row followed by unpacking it returns the original row. IF a row fails a testCase message is output
public
checkPackUnpackTableRows(PackedTableTools $table_factory, array<string|int, mixed> $rows) : mixed
Parameters
- $table_factory : PackedTableTools
-
used for pack and unpacking rows
- $rows : array<string|int, mixed>
-
rows according to $table_factory's signature
Return values
mixed —packUnpackMultiRowTestCase()
This tests packing and unpacking rows according to a PackedTableTools signature in the case that where more than one record can be associated with the primary key (clustering).
public
packUnpackMultiRowTestCase() : mixed
Return values
mixed —packUnpackSingleRowTestCase()
This tests packing and unpacking rows according to a PackedTableTools signature in the case that there is only one record associated with the primary key (no-clustering).
public
packUnpackSingleRowTestCase() : 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
saveAddLoadTestCase()
This tests if a set of rows packed according to a PackedTableTools record is saved that it can be reloaded and unpacked and still get the same results
public
saveAddLoadTestCase() : mixed
Return values
mixed —setUp()
Creates test directory for the tests
public
setUp() : mixed
Return values
mixed —tearDown()
After the tests delete test directory
public
tearDown() : mixed