From de4ebe82e796281458c7dd0ee2ba2d986c3c5806 Mon Sep 17 00:00:00 2001 From: rahul Date: Fri, 22 Sep 2023 14:53:41 +0530 Subject: [PATCH] namespace correction Signed-off-by: rahul --- bin/view-csv | 6 +- bin/view-json | 6 +- composer.json | 5 +- composer.lock | 721 ++++++++++-------- src/CsvFileHandler.php | 6 +- .../ServiceContainer.php | 2 +- src/Exception/FileEncryptorException.php | 2 +- src/Exception/FileHandlerException.php | 2 +- src/Exception/HashException.php | 2 +- src/Exception/StreamException.php | 2 +- src/FileEncryptor.php | 4 +- src/FileHandler.php | 4 +- src/FileHashChecker.php | 5 +- src/JsonFileHandler.php | 6 +- src/StreamHandler.php | 4 +- src/TempFileHandler.php | 4 +- src/Utilities/RowColumnHelper.php | 2 +- src/config/services.yaml | 12 +- tests/Base/BaseTest.php | 2 +- tests/Integration/StreamHandlerTest.php | 10 +- tests/unit/CsvFileHandlerTest.php | 39 +- tests/unit/FileEncryptorTest.php | 4 +- tests/unit/FileHandlerTest.php | 14 +- tests/unit/FileHashCheckerTest.php | 5 +- tests/unit/JsonFileHandlerTest.php | 4 +- tests/unit/TempFileHandlerTest.php | 2 +- 26 files changed, 488 insertions(+), 387 deletions(-) rename src/{DI => DependencyInjection}/ServiceContainer.php (90%) diff --git a/bin/view-csv b/bin/view-csv index 1213f29..4aa6b9a 100755 --- a/bin/view-csv +++ b/bin/view-csv @@ -3,9 +3,9 @@ require 'vendor/autoload.php'; -use rcsofttech85\FileHandler\CsvFileHandler; -use rcsofttech85\FileHandler\DI\ServiceContainer; -use rcsofttech85\FileHandler\Exception\FileHandlerException; +use Rcsofttech85\FileHandler\CsvFileHandler; +use Rcsofttech85\FileHandler\DependencyInjection\ServiceContainer; +use Rcsofttech85\FileHandler\Exception\FileHandlerException; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; diff --git a/bin/view-json b/bin/view-json index c0de117..518c234 100755 --- a/bin/view-json +++ b/bin/view-json @@ -1,9 +1,9 @@ #!/usr/bin/env php =7.0" - }, - "require-dev": { - "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.9-dev" - } + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2023-03-08T13:26:56+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.17.1", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } }, "autoload": { "psr-4": { @@ -1284,73 +1284,135 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } ], - "description": "Library for handling version information and constraints", - "support": { - "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.2.1" - }, - "time": "2022-02-21T01:04:05+00:00" + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "phpstan/phpstan", + "version": "1.10.35", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e730e5facb75ffe09dfb229795e8c01a459f26c3", + "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ { - "name": "phpunit/php-code-coverage", - "version": "10.1.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "cd59bb34756a16ca8253ce9b2909039c227fff71" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/cd59bb34756a16ca8253ce9b2909039c227fff71", - "reference": "cd59bb34756a16ca8253ce9b2909039c227fff71", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-libxml": "*", - "ext-xmlwriter": "*", - "nikic/php-parser": "^4.15", - "php": ">=8.1", - "phpunit/php-file-iterator": "^4.0", - "phpunit/php-text-template": "^3.0", - "sebastian/code-unit-reverse-lookup": "^3.0", - "sebastian/complexity": "^3.0", - "sebastian/environment": "^6.0", - "sebastian/lines-of-code": "^2.0", - "sebastian/version": "^4.0", - "theseer/tokenizer": "^1.2.0" - }, - "require-dev": { - "phpunit/phpunit": "^10.1" - }, - "suggest": { - "ext-pcov": "PHP extension that provides line coverage", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "10.1-dev" - } - }, - "autoload": { - "classmap": [ + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2023-09-19T15:27:56+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "10.1.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "56f33548fe522c8d82da7ff3824b42829d324364" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/56f33548fe522c8d82da7ff3824b42829d324364", + "reference": "56f33548fe522c8d82da7ff3824b42829d324364", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.15", + "php": ">=8.1", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-text-template": "^3.0", + "sebastian/code-unit-reverse-lookup": "^3.0", + "sebastian/complexity": "^3.0", + "sebastian/environment": "^6.0", + "sebastian/lines-of-code": "^2.0", + "sebastian/version": "^4.0", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^10.1" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "10.1-dev" + } + }, + "autoload": { + "classmap": [ "src/" ] }, @@ -1375,7 +1437,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.4" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.6" }, "funding": [ { @@ -1383,7 +1445,7 @@ "type": "github" } ], - "time": "2023-08-31T14:04:38+00:00" + "time": "2023-09-19T04:59:03+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1601,95 +1663,95 @@ ] }, "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:57:52+00:00" + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:57:52+00:00" }, - { - "name": "phpunit/phpunit", - "version": "10.3.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "0dafb1175c366dd274eaa9a625e914451506bcd1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0dafb1175c366dd274eaa9a625e914451506bcd1", - "reference": "0dafb1175c366dd274eaa9a625e914451506bcd1", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", - "php": ">=8.1", - "phpunit/php-code-coverage": "^10.1.1", - "phpunit/php-file-iterator": "^4.0", - "phpunit/php-invoker": "^4.0", - "phpunit/php-text-template": "^3.0", - "phpunit/php-timer": "^6.0", - "sebastian/cli-parser": "^2.0", - "sebastian/code-unit": "^2.0", - "sebastian/comparator": "^5.0", - "sebastian/diff": "^5.0", - "sebastian/environment": "^6.0", - "sebastian/exporter": "^5.0", - "sebastian/global-state": "^6.0.1", - "sebastian/object-enumerator": "^5.0", - "sebastian/recursion-context": "^5.0", - "sebastian/type": "^4.0", - "sebastian/version": "^4.0" - }, - "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "10.3-dev" - } - }, - "autoload": { - "files": [ - "src/Framework/Assert/Functions.php" - ], - "classmap": [ - "src/" - ] - }, + { + "name": "phpunit/phpunit", + "version": "10.3.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "747c3b2038f1139e3dcd9886a3f5a948648b7503" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/747c3b2038f1139e3dcd9886a3f5a948648b7503", + "reference": "747c3b2038f1139e3dcd9886a3f5a948648b7503", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=8.1", + "phpunit/php-code-coverage": "^10.1.5", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-invoker": "^4.0", + "phpunit/php-text-template": "^3.0", + "phpunit/php-timer": "^6.0", + "sebastian/cli-parser": "^2.0", + "sebastian/code-unit": "^2.0", + "sebastian/comparator": "^5.0", + "sebastian/diff": "^5.0", + "sebastian/environment": "^6.0", + "sebastian/exporter": "^5.1", + "sebastian/global-state": "^6.0.1", + "sebastian/object-enumerator": "^5.0", + "sebastian/recursion-context": "^5.0", + "sebastian/type": "^4.0", + "sebastian/version": "^4.0" + }, + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "10.3-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" @@ -1711,7 +1773,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.3.2" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.3.5" }, "funding": [ { @@ -1727,7 +1789,7 @@ "type": "tidelift" } ], - "time": "2023-08-15T05:34:23+00:00" + "time": "2023-09-19T05:42:37+00:00" }, { "name": "sebastian/cli-parser", @@ -2134,78 +2196,78 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "https://github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/environment/issues", - "security": "https://github.com/sebastianbergmann/environment/security/policy", - "source": "https://github.com/sebastianbergmann/environment/tree/6.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-04-11T05:39:26+00:00" + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "https://github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/6.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-04-11T05:39:26+00:00" }, + { + "name": "sebastian/exporter", + "version": "5.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c3fa8483f9539b190f7cd4bfc4a07631dd1df344", + "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/recursion-context": "^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ { - "name": "sebastian/exporter", - "version": "5.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", - "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "php": ">=8.1", - "sebastian/recursion-context": "^5.0" - }, - "require-dev": { - "phpunit/phpunit": "^10.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", "email": "whatthejeff@gmail.com" }, { @@ -2228,8 +2290,9 @@ "exporter" ], "support": { - "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/5.0.0" + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.0" }, "funding": [ { @@ -2237,7 +2300,7 @@ "type": "github" } ], - "time": "2023-02-03T07:06:49+00:00" + "time": "2023-09-18T07:15:37+00:00" }, { "name": "sebastian/global-state", @@ -2919,8 +2982,8 @@ "ext-sodium": "*", "ext-ctype": "*", "ext-zip": "*", - "ext-fileinfo": "*" - }, - "platform-dev": [], - "plugin-api-version": "2.3.0" + "ext-fileinfo": "*" + }, + "platform-dev": [], + "plugin-api-version": "2.3.0" } diff --git a/src/CsvFileHandler.php b/src/CsvFileHandler.php index cd7c55e..9849ca5 100644 --- a/src/CsvFileHandler.php +++ b/src/CsvFileHandler.php @@ -1,10 +1,10 @@ "https://gist.github.com/rcsofttech85/629b37d483c4796db7bdcb3704067631#file-gistfile1-txt", - "output1.html" => "https://gist.github.com/rcsofttech85/f71f2454b1fc40a077cda14ef3097385#file-gistfile1-txt", + "output1.html" => + "https://gist.github.com/rcsofttech85/f71f2454b1fc40a077cda14ef3097385#file-gistfile1-txt", - "output2.html" => "https://gist.github.com/rcsofttech85/79ab19f1502e72c95cfa97d5205fa47d#file-gistfile1-txt" + "output2.html" => + "https://gist.github.com/rcsofttech85/79ab19f1502e72c95cfa97d5205fa47d#file-gistfile1-txt" ] ]; } diff --git a/tests/unit/CsvFileHandlerTest.php b/tests/unit/CsvFileHandlerTest.php index b7930d3..af06362 100644 --- a/tests/unit/CsvFileHandlerTest.php +++ b/tests/unit/CsvFileHandlerTest.php @@ -5,9 +5,9 @@ use Base\BaseTest; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; -use rcsofttech85\FileHandler\CsvFileHandler; -use rcsofttech85\FileHandler\Exception\FileHandlerException; -use rcsofttech85\FileHandler\FileHandler; +use Rcsofttech85\FileHandler\CsvFileHandler; +use Rcsofttech85\FileHandler\Exception\FileHandlerException; +use Rcsofttech85\FileHandler\FileHandler; class CsvFileHandlerTest extends BaseTest { @@ -170,7 +170,38 @@ public function toJsonMethodReturnsValidJsonFormat(): void $this->fail('could not convert to json format'); } - $expectedData = '[{"Film":"Zack and Miri Make a Porno","Genre":"Romance","Lead Studio":"The Weinstein Company","Audience score %":"70","Profitability":"1.747541667","Rotten Tomatoes %":"64","Worldwide Gross":"$41.94 ","Year":"2008"},{"Film":"Youth in Revolt","Genre":"Comedy","Lead Studio":"The Weinstein Company","Audience score %":"52","Profitability":"1.09","Rotten Tomatoes %":"68","Worldwide Gross":"$19.62 ","Year":"2010"},{"Film":"Twilight","Genre":"Romance","Lead Studio":"Independent","Audience score %":"68","Profitability":"6.383363636","Rotten Tomatoes %":"26","Worldwide Gross":"$702.17 ","Year":"2011"}]'; + $expectedData = '[ + { + "Film":"Zack and Miri Make a Porno", + "Genre":"Romance", + "Lead Studio":"The Weinstein Company", + "Audience score %":"70", + "Profitability":"1.747541667", + "Rotten Tomatoes %":"64", + "Worldwide Gross":"$41.94 ", + "Year":"2008" + }, + { + "Film":"Youth in Revolt", + "Genre":"Comedy", + "Lead Studio":"The Weinstein Company", + "Audience score %":"52", + "Profitability":"1.09", + "Rotten Tomatoes %":"68", + "Worldwide Gross":"$19.62 ", + "Year":"2010" + }, + { + "Film":"Twilight", + "Genre":"Romance", + "Lead Studio":"Independent", + "Audience score %":"68", + "Profitability":"6.383363636", + "Rotten Tomatoes %":"26", + "Worldwide Gross":"$702.17 ", + "Year":"2011" + } +]'; $this->assertJson($jsonData); $this->assertJsonStringEqualsJsonString($expectedData, $jsonData); diff --git a/tests/unit/FileEncryptorTest.php b/tests/unit/FileEncryptorTest.php index 1db52aa..90b6c18 100644 --- a/tests/unit/FileEncryptorTest.php +++ b/tests/unit/FileEncryptorTest.php @@ -4,8 +4,8 @@ use Base\BaseTest; use PHPUnit\Framework\Attributes\Test; -use rcsofttech85\FileHandler\Exception\FileEncryptorException; -use rcsofttech85\FileHandler\FileEncryptor; +use Rcsofttech85\FileHandler\Exception\FileEncryptorException; +use Rcsofttech85\FileHandler\FileEncryptor; class FileEncryptorTest extends BaseTest { diff --git a/tests/unit/FileHandlerTest.php b/tests/unit/FileHandlerTest.php index 4594944..1aa44fb 100644 --- a/tests/unit/FileHandlerTest.php +++ b/tests/unit/FileHandlerTest.php @@ -4,8 +4,8 @@ use Base\BaseTest; use PHPUnit\Framework\Attributes\Test; -use rcsofttech85\FileHandler\Exception\FileHandlerException; -use rcsofttech85\FileHandler\FileHandler; +use Rcsofttech85\FileHandler\Exception\FileHandlerException; +use Rcsofttech85\FileHandler\FileHandler; class FileHandlerTest extends BaseTest { @@ -98,10 +98,12 @@ public function successfulDecompression(): void $this->fileHandler->decompress($compressedZip, $extractPath); - $expectedContent = "Film,Genre,Lead Studio,Audience score %,Profitability,Rotten Tomatoes %,Worldwide Gross,Year\n" - . "Zack and Miri Make a Porno,Romance,The Weinstein Company,70,1.747541667,64,$41.94 ,2008\n" - . "Youth in Revolt,Comedy,The Weinstein Company,52,1.09,68,$19.62 ,2010\n" - . "Twilight,Romance,Independent,68,6.383363636,26,$702.17 ,2011"; + $expectedContent = <<assertEquals($expectedContent, file_get_contents("./extracted_contents/movie.csv")); diff --git a/tests/unit/FileHashCheckerTest.php b/tests/unit/FileHashCheckerTest.php index dc8ee9e..64d3566 100644 --- a/tests/unit/FileHashCheckerTest.php +++ b/tests/unit/FileHashCheckerTest.php @@ -4,7 +4,7 @@ use Base\BaseTest; use PHPUnit\Framework\Attributes\Test; -use rcsofttech85\FileHandler\FileHashChecker; +use Rcsofttech85\FileHandler\FileHashChecker; use Symfony\Component\Dotenv\Dotenv; class FileHashCheckerTest extends BaseTest @@ -50,7 +50,8 @@ public function shouldGenerateValidHashForDifferentAlgo(): void $this->assertEquals($expectedHash, $actualHash); - $expectedHash = "1050bcc2d7d840d634f067a22abb4cd693b1f2590849982e29a6f9bb28963f73392b63ea24ae17edfaa500ee62b9e5482b9648af0b2b7d941992af3b0f9cbd3b"; + $expectedHash = "1050bcc2d7d840d634f067a22abb4cd693b1f2590849982e29a6f9bb28963f733" . + "92b63ea24ae17edfaa500ee62b9e5482b9648af0b2b7d941992af3b0f9cbd3b"; $actualHash = $this->fileHash->hashFile(FileHashChecker::ALGO_512); diff --git a/tests/unit/JsonFileHandlerTest.php b/tests/unit/JsonFileHandlerTest.php index 62584f0..c1a8362 100644 --- a/tests/unit/JsonFileHandlerTest.php +++ b/tests/unit/JsonFileHandlerTest.php @@ -5,8 +5,8 @@ use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; -use rcsofttech85\FileHandler\Exception\FileHandlerException; -use rcsofttech85\FileHandler\JsonFileHandler; +use Rcsofttech85\FileHandler\Exception\FileHandlerException; +use Rcsofttech85\FileHandler\JsonFileHandler; class JsonFileHandlerTest extends TestCase { diff --git a/tests/unit/TempFileHandlerTest.php b/tests/unit/TempFileHandlerTest.php index d658d8f..6825d1d 100644 --- a/tests/unit/TempFileHandlerTest.php +++ b/tests/unit/TempFileHandlerTest.php @@ -4,7 +4,7 @@ use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; -use rcsofttech85\FileHandler\TempFileHandler; +use Rcsofttech85\FileHandler\TempFileHandler; class TempFileHandlerTest extends TestCase {