Skip to content

Commit

Permalink
Improve unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
webeweb committed Oct 7, 2022
1 parent 0e4066d commit 2634131
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions tests/adoria/Serializer/RequestSerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function testSerializeRequestData(): void {
"BuyDateMax" => "2019-01-22",
"IdentificationKey" => "identificationKey",
];

$this->assertEquals($exp, $obj);
}

Expand Down
1 change: 1 addition & 0 deletions tests/curl/Request/PostRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public function testAddPostData(): void {
$obj->addPostData("name", "value");

$exp = ["name" => "value"];

$this->assertEquals($exp, $obj->getPostData());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public function testGetConnectionWithPDOException(): void {
*/
public function testPrepareBinding(): void {

$obj = new MicrosoftAccessDatabaseConnector($this->authenticator, null);

$arg = ["field1", "field2", "field3"];
$exp = ["field1" => ":field1", "field2" => ":field2", "field3" => ":field3"];

$obj = new MicrosoftAccessDatabaseConnector($this->authenticator, null);

$this->assertEquals($exp, $obj->prepareBinding($arg));
}

Expand All @@ -88,11 +88,11 @@ public function testPrepareBinding(): void {
*/
public function testPrepareInsert(): void {

$obj = new MicrosoftAccessDatabaseConnector($this->authenticator, null);

$arg = ["field1" => 1, "field2" => "'value2'", "field3" => "'value3'"];
$exp = "INSERT INTO table (`field1`, `field2`, `field3`) VALUES (1, 'value2', 'value3')";

$obj = new MicrosoftAccessDatabaseConnector($this->authenticator, null);

$this->assertEquals($exp, $obj->prepareInsert("table", $arg));
}

Expand All @@ -107,6 +107,7 @@ public function testPrepareUpdate(): void {

$arg = ["field1" => 1, "field2" => "'value2'", "field3" => "'value3'"];
$exp = "UPDATE table SET `field1` = 1, `field2` = 'value2', `field3` = 'value3'";

$this->assertEquals($exp, $obj->prepareUpdate("table", $arg));
}

Expand Down
1 change: 1 addition & 0 deletions tests/image/Helper/ImageHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function testBase64Encode(): void {
$url = "https://raw.githubusercontent.com/webeweb/core-library/master/tests/image/Fixtures/TestImage_1920x1037.jpg";

$exp = file_get_contents(__DIR__ . "/ImageHelperTest.testBase64Encode.txt");

$this->assertEquals($exp, ImageHelper::base64Encode($uri));
$this->assertEquals($exp, ImageHelper::base64Encode($url));

Expand Down
1 change: 1 addition & 0 deletions tests/image/Model/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function testBase64Encode(): void {
$obj = new Image($this->images[0]);

$exp = file_get_contents(__DIR__ . "/../Helper/ImageHelperTest.testBase64Encode.txt");

$this->assertEquals($exp, $obj->base64Encode());
}

Expand Down
2 changes: 2 additions & 0 deletions tests/maths/Helper/FibonacciHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function testFibonacciWithNegative(): void {
public function testSequence(): void {

$exp = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];

$this->assertEquals($exp, FibonacciHelper::sequence(10));
}

Expand All @@ -81,6 +82,7 @@ public function testSequence(): void {
public function testSequenceWithNegative(): void {

$exp = [0, 1, -1, 2, -3, 5, -8, 13, -21, 34, -55];

$this->assertEquals($exp, FibonacciHelper::sequence(-10));
}
}
1 change: 1 addition & 0 deletions tests/ocrlad/Provider/OcrProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function testBuildFilePaths(): void {
"/localDirectoryAfter/~$md5.tif",
],
];

$res = $obj->buildFilePaths($file);
$this->assertEquals($exp, $res);
}
Expand Down
1 change: 1 addition & 0 deletions tests/skidata/Parser/CardParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function testParseEntity(): void {
$obj->setProductionFacilityNumber(1234567);

$exp = '"ticketNumber";987654321;321;20170920;20170921;1;;2;0;3412;0;0;1;1;0;1;"displayText1";"displayText2";9876;123456789012;"serialNumberKeyCard";"3.0";3;"ticke";"serialNo";;20170922;1;1234567';

$this->assertEquals($exp, (new CardParser())->parseEntity($obj));
}

Expand Down
1 change: 1 addition & 0 deletions tests/skidata/Parser/CustomerParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function testParseEntity(): void {
$obj->setAccountingNumber("accountingNumber");

$exp = '123456789;"title";"surname";"firstname";"street";"pCode";"city";"abc";"taxCode";"idDocumentNo";"telephone";"rentalAgreementNo";20170921;20170930;000000123456;1234;"remarks";20170921 103500;0;;0;1;1;0;1;"remarks2";"remarks3";"division";"email";0;"abc";"accountingNumber"';

$this->assertEquals($exp, (new CustomerParser())->parseEntity($obj));
}

Expand Down
1 change: 1 addition & 0 deletions tests/skidata/Parser/StartRecordFormatParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function testParseEntity(): void {
$obj->setCurrency("EUR");

$exp = '190000;0202747;20170921;00018;"EUR"';

$this->assertEquals($exp, (new StartRecordFormatParser())->parseEntity($obj));
}

Expand Down
1 change: 1 addition & 0 deletions tests/skidata/Parser/UserParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function testParseEntity(): void {
$obj->setETicketServiceArt(2);

$exp = '987654321;123456789;"title";"surname";"firstname";20170920;"12345";"remarks";20170921 115500;0;"identificationNumber";0;1;1;"creditCardNumber";;"remarks2";"remarks3";"division";"email";1;1;"eTicketEmailTelephone";1;3;2';

$this->assertEquals($exp, (new UserParser())->parseEntity($obj));
}

Expand Down
1 change: 1 addition & 0 deletions tests/sorter/QuickSortTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function testSort(): void {
$obj->sort();

$exp = [12, 21, 23, 32, 34, 43, 45, 54, 56, 65, 67, 76, 78, 87, 89, 98];

$this->assertEquals($exp, $obj->getValues());
}

Expand Down
1 change: 1 addition & 0 deletions tests/symfony/Helper/ColorHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function testGetIdentifier(): void {
$colorProvider = new RedColorProvider();

$exp = implode(":", ["MaterialDesignColorPalette", "red"]);

$this->assertEquals($exp, ColorHelper::getIdentifier($colorProvider));
}

Expand Down
1 change: 1 addition & 0 deletions tests/symfony/Service/PhantomJSServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function testGetCommand(): void {
if ("\\" === DIRECTORY_SEPARATOR) {
$exp .= ".exe";
}

$this->assertEquals($exp, $obj->getCommand());
}

Expand Down
1 change: 1 addition & 0 deletions tests/validator/Status/DefaultStatusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function testJsonSerialize(): void {
$obj->setRuleName("ruleName");

$exp = ["code" => 200, "message" => "message", "ruleName" => "ruleName"];

$this->assertEquals($exp, $obj->jsonSerialize());
}

Expand Down

0 comments on commit 2634131

Please sign in to comment.