From 599881aebc78004baeec4566cac51f52ceb79b0c Mon Sep 17 00:00:00 2001 From: katheroine Date: Mon, 6 Nov 2023 14:21:04 +0100 Subject: [PATCH 01/26] Exorg vendor name in namespaces changed to ExOrg (ExOrg#107) --- README.md | 12 ++++----- composer.json | 4 +-- phpcs.xml | 2 +- src/coder_builder/CoderBuildingTrait.php | 2 +- .../CoderClassNotFoundException.php | 2 +- .../data_decoders/AbstractDataDecoder.php | 2 +- .../data_coders/data_decoders/DataDecoder.php | 2 +- .../DataDecodingStrategyInterface.php | 2 +- .../data_decoders/JsonDataDecoder.php | 2 +- .../data_decoders/YamlDataDecoder.php | 2 +- .../data_encoders/AbstractDataEncoder.php | 2 +- .../data_coders/data_encoders/DataEncoder.php | 2 +- .../DataEncodingStrategyInterface.php | 2 +- .../data_encoders/JsonDataEncoder.php | 2 +- .../data_encoders/YamlDataEncoder.php | 2 +- .../datafile_coders/AbstractDatafileCoder.php | 2 +- .../datafile_decoders/DatafileDecoder.php | 2 +- .../datafile_decoders/JsonDatafileDecoder.php | 2 +- .../datafile_decoders/YamlDatafileDecoder.php | 2 +- .../datafile_encoders/DatafileEncoder.php | 2 +- .../datafile_encoders/JsonDatafileEncoder.php | 2 +- .../datafile_encoders/YamlDatafileEncoder.php | 2 +- src/data_format/DataFormat.php | 2 +- .../DataFormatConfigurableTrait.php | 2 +- .../DataFormatInvalidException.php | 2 +- src/file/File.php | 2 +- src/file/FileException.php | 2 +- .../classes/DummyClassFormat1Decoder.php | 2 +- .../classes/DummyClassFormat1Encoder.php | 2 +- .../classes/DummyClassFormat1Nocoder.php | 2 +- .../classes/DummyClassFormat2Decoder.php | 2 +- .../classes/DummyClassFormat2Encoder.php | 2 +- .../classes/DummyClassFormat2Nocoder.php | 2 +- .../DummyClassFormatNotRecognizedDecoder.php | 2 +- .../DummyClassFormatNotRecognizedEncoder.php | 2 +- .../classes/DummyClassFormatNullDecoder.php | 2 +- .../classes/DummyClassFormatNullEncoder.php | 2 +- .../classes/Format1DataDecoder.php | 2 +- .../classes/Format1DataEncoder.php | 2 +- .../classes/Format1DummyClassDecoder.php | 2 +- .../classes/Format1DummyClassEncoder.php | 2 +- .../classes/Format1DummyClassNocoder.php | 2 +- .../classes/Format2DataDecoder.php | 2 +- .../classes/Format2DataEncoder.php | 2 +- .../classes/Format2DummyClassDecoder.php | 2 +- .../classes/Format2DummyClassEncoder.php | 2 +- .../classes/Format2DummyClassNocoder.php | 2 +- .../classes/Format3DataDecoder.php | 2 +- .../classes/Format3DataEncoder.php | 2 +- .../classes/FormatDataDecoder.php | 2 +- .../classes/FormatDataEncoder.php | 2 +- .../FormatnotrecognizedDummyClassDecoder.php | 2 +- .../FormatnotrecognizedDummyClassEncoder.php | 2 +- .../helpers/DataFileFixturesHelper.php | 2 +- .../helpers/DataFileFixturesHelperTest.php | 18 ++++++------- .../coder_builder/CoderBuildingTraitTest.php | 14 +++++----- .../CoderClassNotFoundExceptionTest.php | 6 ++--- .../data_decoders/DataDecoderTest.php | 12 ++++----- .../data_decoders/JsonDataDecoderTest.php | 8 +++--- .../data_decoders/YamlDataDecoderTest.php | 8 +++--- .../data_encoders/DataEncoderTest.php | 12 ++++----- .../data_encoders/JsonDataEncoderTest.php | 6 ++--- .../data_encoders/YamlDataEncoderTest.php | 6 ++--- .../datafile_decoders/DatafileDecoderTest.php | 18 ++++++------- .../JsonDatafileDecoderTest.php | 14 +++++----- .../YamlDatafileDecoderTest.php | 14 +++++----- .../datafile_encoders/DatafileEncoderTest.php | 16 ++++++------ .../JsonDatafileEncoderTest.php | 10 +++---- .../YamlDatafileEncoderTest.php | 10 +++---- .../DataFormatInvalidExceptionTest.php | 6 ++--- .../unit_tests/data_format/DataFormatTest.php | 8 +++--- tests/unit_tests/file/FileExceptionTest.php | 6 ++--- tests/unit_tests/file/FileTest.php | 26 +++++++++---------- 73 files changed, 169 insertions(+), 169 deletions(-) diff --git a/README.md b/README.md index 7686993..f35acad 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ require_once (__DIR__ . '/vendor/autoload.php'); ```php -use Exorg\DataCoder\JsonDataEncoder; +use ExOrg\DataCoder\JsonDataEncoder; $data = [ "firstName" => "John", @@ -108,7 +108,7 @@ print($result); ```php -use Exorg\DataCoder\YamlDataDecoder; +use ExOrg\DataCoder\YamlDataDecoder; $data = ' --- @@ -147,7 +147,7 @@ Array ### Data Encoder with configurable format ```php -use Exorg\DataCoder\DataEncoder; +use ExOrg\DataCoder\DataEncoder; $data = [ "firstName" => "John", @@ -183,7 +183,7 @@ address: ### Data Decoder with configurable format ```php -use Exorg\DataCoder\DataDecoder; +use ExOrg\DataCoder\DataDecoder; $data = ' { @@ -234,7 +234,7 @@ Datafile coders with configurable data format - **DatafileEncoder** and **Datafi ##### DatafileEncoder ```php -use Exorg\DataCoder\DatafileEncoder; +use ExOrg\DataCoder\DatafileEncoder; $data = [ "firstName" => "John", @@ -271,7 +271,7 @@ print file_get_contents($datafilePath); ##### DatafileDecoder ```php -use Exorg\DataCoder\DatafileDecoder; +use ExOrg\DataCoder\DatafileDecoder; $datafilePath = 'data.yaml'; diff --git a/composer.json b/composer.json index 53711af..3a06930 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ }, "autoload": { "psr-4": { - "Exorg\\DataCoder\\": [ + "ExOrg\\DataCoder\\": [ "src/", "src/coders", "src/coders/data_coders/", @@ -45,7 +45,7 @@ }, "autoload-dev": { "psr-4": { - "Exorg\\DataCoder\\": [ + "ExOrg\\DataCoder\\": [ "tests/", "tests/testing_environment/", "tests/testing_environment/helpers/", diff --git a/phpcs.xml b/phpcs.xml index 925f393..2831708 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,5 +1,5 @@ - + The coding standard for PHPDataCoder. ./src diff --git a/src/coder_builder/CoderBuildingTrait.php b/src/coder_builder/CoderBuildingTrait.php index 29895fe..fb8c69f 100644 --- a/src/coder_builder/CoderBuildingTrait.php +++ b/src/coder_builder/CoderBuildingTrait.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * CoderBuildingTrait. diff --git a/src/coder_builder/CoderClassNotFoundException.php b/src/coder_builder/CoderClassNotFoundException.php index e2bfd47..f4c13cf 100644 --- a/src/coder_builder/CoderClassNotFoundException.php +++ b/src/coder_builder/CoderClassNotFoundException.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * CoderClassNotFoundException. diff --git a/src/coders/data_coders/data_decoders/AbstractDataDecoder.php b/src/coders/data_coders/data_decoders/AbstractDataDecoder.php index 54197c0..df084f3 100644 --- a/src/coders/data_coders/data_decoders/AbstractDataDecoder.php +++ b/src/coders/data_coders/data_decoders/AbstractDataDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * AbstractDataDecoder. diff --git a/src/coders/data_coders/data_decoders/DataDecoder.php b/src/coders/data_coders/data_decoders/DataDecoder.php index a52c9dc..b440a82 100644 --- a/src/coders/data_coders/data_decoders/DataDecoder.php +++ b/src/coders/data_coders/data_decoders/DataDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * DataDecoder. diff --git a/src/coders/data_coders/data_decoders/DataDecodingStrategyInterface.php b/src/coders/data_coders/data_decoders/DataDecodingStrategyInterface.php index 94f47f4..655a926 100644 --- a/src/coders/data_coders/data_decoders/DataDecodingStrategyInterface.php +++ b/src/coders/data_coders/data_decoders/DataDecodingStrategyInterface.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * DataDecodingStrategyInterface. diff --git a/src/coders/data_coders/data_decoders/JsonDataDecoder.php b/src/coders/data_coders/data_decoders/JsonDataDecoder.php index bf7a71e..85d370f 100644 --- a/src/coders/data_coders/data_decoders/JsonDataDecoder.php +++ b/src/coders/data_coders/data_decoders/JsonDataDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * JsonDataDecoder. diff --git a/src/coders/data_coders/data_decoders/YamlDataDecoder.php b/src/coders/data_coders/data_decoders/YamlDataDecoder.php index a0cb0df..bd4bfad 100644 --- a/src/coders/data_coders/data_decoders/YamlDataDecoder.php +++ b/src/coders/data_coders/data_decoders/YamlDataDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use Symfony\Component\Yaml\Yaml; diff --git a/src/coders/data_coders/data_encoders/AbstractDataEncoder.php b/src/coders/data_coders/data_encoders/AbstractDataEncoder.php index 11875d8..ac7884a 100644 --- a/src/coders/data_coders/data_encoders/AbstractDataEncoder.php +++ b/src/coders/data_coders/data_encoders/AbstractDataEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * AbstractDataEncoder. diff --git a/src/coders/data_coders/data_encoders/DataEncoder.php b/src/coders/data_coders/data_encoders/DataEncoder.php index 1bbf280..344fc06 100644 --- a/src/coders/data_coders/data_encoders/DataEncoder.php +++ b/src/coders/data_coders/data_encoders/DataEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * DataEncoder. diff --git a/src/coders/data_coders/data_encoders/DataEncodingStrategyInterface.php b/src/coders/data_coders/data_encoders/DataEncodingStrategyInterface.php index c6fc7e3..de5a218 100644 --- a/src/coders/data_coders/data_encoders/DataEncodingStrategyInterface.php +++ b/src/coders/data_coders/data_encoders/DataEncodingStrategyInterface.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * DataEncodingStrategyInterface. diff --git a/src/coders/data_coders/data_encoders/JsonDataEncoder.php b/src/coders/data_coders/data_encoders/JsonDataEncoder.php index 7826aae..9bb730c 100644 --- a/src/coders/data_coders/data_encoders/JsonDataEncoder.php +++ b/src/coders/data_coders/data_encoders/JsonDataEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * JsonDataEncoder. diff --git a/src/coders/data_coders/data_encoders/YamlDataEncoder.php b/src/coders/data_coders/data_encoders/YamlDataEncoder.php index e31fed7..3da42b1 100644 --- a/src/coders/data_coders/data_encoders/YamlDataEncoder.php +++ b/src/coders/data_coders/data_encoders/YamlDataEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use Symfony\Component\Yaml\Yaml; diff --git a/src/coders/datafile_coders/AbstractDatafileCoder.php b/src/coders/datafile_coders/AbstractDatafileCoder.php index d04b640..80b96f6 100644 --- a/src/coders/datafile_coders/AbstractDatafileCoder.php +++ b/src/coders/datafile_coders/AbstractDatafileCoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * AbstractDatafileCoder. diff --git a/src/coders/datafile_coders/datafile_decoders/DatafileDecoder.php b/src/coders/datafile_coders/datafile_decoders/DatafileDecoder.php index 0186572..3853a22 100644 --- a/src/coders/datafile_coders/datafile_decoders/DatafileDecoder.php +++ b/src/coders/datafile_coders/datafile_decoders/DatafileDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * DatafileDecoder. diff --git a/src/coders/datafile_coders/datafile_decoders/JsonDatafileDecoder.php b/src/coders/datafile_coders/datafile_decoders/JsonDatafileDecoder.php index b1ee2e5..d2fa247 100644 --- a/src/coders/datafile_coders/datafile_decoders/JsonDatafileDecoder.php +++ b/src/coders/datafile_coders/datafile_decoders/JsonDatafileDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * JsonDatafileDecoder. diff --git a/src/coders/datafile_coders/datafile_decoders/YamlDatafileDecoder.php b/src/coders/datafile_coders/datafile_decoders/YamlDatafileDecoder.php index fbb49d3..2210863 100644 --- a/src/coders/datafile_coders/datafile_decoders/YamlDatafileDecoder.php +++ b/src/coders/datafile_coders/datafile_decoders/YamlDatafileDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * YamlDatafileDecoder. diff --git a/src/coders/datafile_coders/datafile_encoders/DatafileEncoder.php b/src/coders/datafile_coders/datafile_encoders/DatafileEncoder.php index f9a1380..bc70f46 100644 --- a/src/coders/datafile_coders/datafile_encoders/DatafileEncoder.php +++ b/src/coders/datafile_coders/datafile_encoders/DatafileEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * DatafileEncoder. diff --git a/src/coders/datafile_coders/datafile_encoders/JsonDatafileEncoder.php b/src/coders/datafile_coders/datafile_encoders/JsonDatafileEncoder.php index 1fcad46..b355778 100644 --- a/src/coders/datafile_coders/datafile_encoders/JsonDatafileEncoder.php +++ b/src/coders/datafile_coders/datafile_encoders/JsonDatafileEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * JsonDatafileEncoder. diff --git a/src/coders/datafile_coders/datafile_encoders/YamlDatafileEncoder.php b/src/coders/datafile_coders/datafile_encoders/YamlDatafileEncoder.php index 5786aa8..8574b42 100644 --- a/src/coders/datafile_coders/datafile_encoders/YamlDatafileEncoder.php +++ b/src/coders/datafile_coders/datafile_encoders/YamlDatafileEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * YamlDatafileEncoder. diff --git a/src/data_format/DataFormat.php b/src/data_format/DataFormat.php index cd4299f..78f46df 100644 --- a/src/data_format/DataFormat.php +++ b/src/data_format/DataFormat.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use Garoevans\PhpEnum\Enum; diff --git a/src/data_format/DataFormatConfigurableTrait.php b/src/data_format/DataFormatConfigurableTrait.php index b1a58b9..dada6e2 100644 --- a/src/data_format/DataFormatConfigurableTrait.php +++ b/src/data_format/DataFormatConfigurableTrait.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * DataFormatConfigurableTrait. diff --git a/src/data_format/DataFormatInvalidException.php b/src/data_format/DataFormatInvalidException.php index 5b8248c..d4714c3 100644 --- a/src/data_format/DataFormatInvalidException.php +++ b/src/data_format/DataFormatInvalidException.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * DataFormatInvalidException. diff --git a/src/file/File.php b/src/file/File.php index 1113a34..34b9598 100644 --- a/src/file/File.php +++ b/src/file/File.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * File. diff --git a/src/file/FileException.php b/src/file/FileException.php index 82ea373..4b2c2b4 100644 --- a/src/file/FileException.php +++ b/src/file/FileException.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * NonexistentFileException. diff --git a/tests/testing_environment/classes/DummyClassFormat1Decoder.php b/tests/testing_environment/classes/DummyClassFormat1Decoder.php index 699e45e..07b32ab 100644 --- a/tests/testing_environment/classes/DummyClassFormat1Decoder.php +++ b/tests/testing_environment/classes/DummyClassFormat1Decoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormat1Encoder.php b/tests/testing_environment/classes/DummyClassFormat1Encoder.php index 13e7ebb..9302fce 100644 --- a/tests/testing_environment/classes/DummyClassFormat1Encoder.php +++ b/tests/testing_environment/classes/DummyClassFormat1Encoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormat1Nocoder.php b/tests/testing_environment/classes/DummyClassFormat1Nocoder.php index 7d32ea1..634ffd6 100644 --- a/tests/testing_environment/classes/DummyClassFormat1Nocoder.php +++ b/tests/testing_environment/classes/DummyClassFormat1Nocoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormat2Decoder.php b/tests/testing_environment/classes/DummyClassFormat2Decoder.php index 7ee3c4c..5131697 100644 --- a/tests/testing_environment/classes/DummyClassFormat2Decoder.php +++ b/tests/testing_environment/classes/DummyClassFormat2Decoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormat2Encoder.php b/tests/testing_environment/classes/DummyClassFormat2Encoder.php index a70cc39..be87fd3 100644 --- a/tests/testing_environment/classes/DummyClassFormat2Encoder.php +++ b/tests/testing_environment/classes/DummyClassFormat2Encoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormat2Nocoder.php b/tests/testing_environment/classes/DummyClassFormat2Nocoder.php index 7f6830b..e676f1a 100644 --- a/tests/testing_environment/classes/DummyClassFormat2Nocoder.php +++ b/tests/testing_environment/classes/DummyClassFormat2Nocoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormatNotRecognizedDecoder.php b/tests/testing_environment/classes/DummyClassFormatNotRecognizedDecoder.php index ac05e24..627bf54 100644 --- a/tests/testing_environment/classes/DummyClassFormatNotRecognizedDecoder.php +++ b/tests/testing_environment/classes/DummyClassFormatNotRecognizedDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormatNotRecognizedEncoder.php b/tests/testing_environment/classes/DummyClassFormatNotRecognizedEncoder.php index e08f64a..48b61d5 100644 --- a/tests/testing_environment/classes/DummyClassFormatNotRecognizedEncoder.php +++ b/tests/testing_environment/classes/DummyClassFormatNotRecognizedEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormatNullDecoder.php b/tests/testing_environment/classes/DummyClassFormatNullDecoder.php index a235282..ea7258b 100644 --- a/tests/testing_environment/classes/DummyClassFormatNullDecoder.php +++ b/tests/testing_environment/classes/DummyClassFormatNullDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormatNullEncoder.php b/tests/testing_environment/classes/DummyClassFormatNullEncoder.php index ec9612c..a55720a 100644 --- a/tests/testing_environment/classes/DummyClassFormatNullEncoder.php +++ b/tests/testing_environment/classes/DummyClassFormatNullEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format1DataDecoder.php b/tests/testing_environment/classes/Format1DataDecoder.php index 7085c73..0ba1fdd 100644 --- a/tests/testing_environment/classes/Format1DataDecoder.php +++ b/tests/testing_environment/classes/Format1DataDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy data decoder for testing purposes only. diff --git a/tests/testing_environment/classes/Format1DataEncoder.php b/tests/testing_environment/classes/Format1DataEncoder.php index 052d4db..c56fbe3 100644 --- a/tests/testing_environment/classes/Format1DataEncoder.php +++ b/tests/testing_environment/classes/Format1DataEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy data encoder for testing purposes only. diff --git a/tests/testing_environment/classes/Format1DummyClassDecoder.php b/tests/testing_environment/classes/Format1DummyClassDecoder.php index 6f4f749..9402244 100644 --- a/tests/testing_environment/classes/Format1DummyClassDecoder.php +++ b/tests/testing_environment/classes/Format1DummyClassDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format1DummyClassEncoder.php b/tests/testing_environment/classes/Format1DummyClassEncoder.php index 7432725..e80bfa7 100644 --- a/tests/testing_environment/classes/Format1DummyClassEncoder.php +++ b/tests/testing_environment/classes/Format1DummyClassEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format1DummyClassNocoder.php b/tests/testing_environment/classes/Format1DummyClassNocoder.php index d74ea9b..89cd308 100644 --- a/tests/testing_environment/classes/Format1DummyClassNocoder.php +++ b/tests/testing_environment/classes/Format1DummyClassNocoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format2DataDecoder.php b/tests/testing_environment/classes/Format2DataDecoder.php index 9cc0537..ee97396 100644 --- a/tests/testing_environment/classes/Format2DataDecoder.php +++ b/tests/testing_environment/classes/Format2DataDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy data decoder for testing purposes only. diff --git a/tests/testing_environment/classes/Format2DataEncoder.php b/tests/testing_environment/classes/Format2DataEncoder.php index 0d4a644..76e23ff 100644 --- a/tests/testing_environment/classes/Format2DataEncoder.php +++ b/tests/testing_environment/classes/Format2DataEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy data encoder for testing purposes only. diff --git a/tests/testing_environment/classes/Format2DummyClassDecoder.php b/tests/testing_environment/classes/Format2DummyClassDecoder.php index 636b86d..9901632 100644 --- a/tests/testing_environment/classes/Format2DummyClassDecoder.php +++ b/tests/testing_environment/classes/Format2DummyClassDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format2DummyClassEncoder.php b/tests/testing_environment/classes/Format2DummyClassEncoder.php index 3e79eff..3ee952d 100644 --- a/tests/testing_environment/classes/Format2DummyClassEncoder.php +++ b/tests/testing_environment/classes/Format2DummyClassEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format2DummyClassNocoder.php b/tests/testing_environment/classes/Format2DummyClassNocoder.php index 2e79f94..55ae4e2 100644 --- a/tests/testing_environment/classes/Format2DummyClassNocoder.php +++ b/tests/testing_environment/classes/Format2DummyClassNocoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format3DataDecoder.php b/tests/testing_environment/classes/Format3DataDecoder.php index 79d6db3..5be5449 100644 --- a/tests/testing_environment/classes/Format3DataDecoder.php +++ b/tests/testing_environment/classes/Format3DataDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy data decoder for testing purposes only. diff --git a/tests/testing_environment/classes/Format3DataEncoder.php b/tests/testing_environment/classes/Format3DataEncoder.php index 2aa1934..173b5fe 100644 --- a/tests/testing_environment/classes/Format3DataEncoder.php +++ b/tests/testing_environment/classes/Format3DataEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy data encoder for testing purposes only. diff --git a/tests/testing_environment/classes/FormatDataDecoder.php b/tests/testing_environment/classes/FormatDataDecoder.php index 87182b2..1775910 100644 --- a/tests/testing_environment/classes/FormatDataDecoder.php +++ b/tests/testing_environment/classes/FormatDataDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * FormatDataDecoder. diff --git a/tests/testing_environment/classes/FormatDataEncoder.php b/tests/testing_environment/classes/FormatDataEncoder.php index cd8d61a..76f8549 100644 --- a/tests/testing_environment/classes/FormatDataEncoder.php +++ b/tests/testing_environment/classes/FormatDataEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * FormatDataEncoder. diff --git a/tests/testing_environment/classes/FormatnotrecognizedDummyClassDecoder.php b/tests/testing_environment/classes/FormatnotrecognizedDummyClassDecoder.php index a29f197..02eef99 100644 --- a/tests/testing_environment/classes/FormatnotrecognizedDummyClassDecoder.php +++ b/tests/testing_environment/classes/FormatnotrecognizedDummyClassDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/FormatnotrecognizedDummyClassEncoder.php b/tests/testing_environment/classes/FormatnotrecognizedDummyClassEncoder.php index 9906abc..25f26e1 100644 --- a/tests/testing_environment/classes/FormatnotrecognizedDummyClassEncoder.php +++ b/tests/testing_environment/classes/FormatnotrecognizedDummyClassEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * Dummy class for testing diff --git a/tests/testing_environment/helpers/DataFileFixturesHelper.php b/tests/testing_environment/helpers/DataFileFixturesHelper.php index 64edfa9..ac7a3c9 100644 --- a/tests/testing_environment/helpers/DataFileFixturesHelper.php +++ b/tests/testing_environment/helpers/DataFileFixturesHelper.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; /** * DataFileFixturesHelper. diff --git a/tests/testing_environment/helpers/DataFileFixturesHelperTest.php b/tests/testing_environment/helpers/DataFileFixturesHelperTest.php index 48ef5ae..8385c89 100644 --- a/tests/testing_environment/helpers/DataFileFixturesHelperTest.php +++ b/tests/testing_environment/helpers/DataFileFixturesHelperTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; @@ -34,13 +34,13 @@ class DataFileFixturesHelperTest extends TestCase private $dataFileFixturesHelper = null; /** - * Test if Exorg\DataCoder\DataFileFixturesHelper class + * Test if ExOrg\DataCoder\DataFileFixturesHelper class * has been created. */ public function testDataCodersTestHelperClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\DataFileFixturesHelper') + class_exists('ExOrg\DataCoder\DataFileFixturesHelper') ); } @@ -52,7 +52,7 @@ public function testSetDataFormatFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\DataFileFixturesHelper', + 'ExOrg\DataCoder\DataFileFixturesHelper', 'setDataFormat' ) ); @@ -66,7 +66,7 @@ public function testLoadEncodedDataFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\DataFileFixturesHelper', + 'ExOrg\DataCoder\DataFileFixturesHelper', 'loadEncodedData' ) ); @@ -106,7 +106,7 @@ public function testLoadDecodedDataFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\DataFileFixturesHelper', + 'ExOrg\DataCoder\DataFileFixturesHelper', 'loadDecodedData' ) ); @@ -148,7 +148,7 @@ public function testBuildEncodedFilePathFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\DataFileFixturesHelper', + 'ExOrg\DataCoder\DataFileFixturesHelper', 'buildEncodedFilePath' ) ); @@ -174,7 +174,7 @@ public function testBuildDecodedFilePathFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\DataFileFixturesHelper', + 'ExOrg\DataCoder\DataFileFixturesHelper', 'buildDecodedFilePath' ) ); @@ -200,7 +200,7 @@ public function testBuildCreatedFilePathFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\DataFileFixturesHelper', + 'ExOrg\DataCoder\DataFileFixturesHelper', 'buildCreatedFilePath' ) ); diff --git a/tests/unit_tests/coder_builder/CoderBuildingTraitTest.php b/tests/unit_tests/coder_builder/CoderBuildingTraitTest.php index 9cb758a..3d2edc5 100644 --- a/tests/unit_tests/coder_builder/CoderBuildingTraitTest.php +++ b/tests/unit_tests/coder_builder/CoderBuildingTraitTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; @@ -32,13 +32,13 @@ class CoderBuildingTraitTest extends TestCase const DUMMY_CODERS_NAMESPACE = __NAMESPACE__; /** - * Test Exorg\DatafilesParser\CoderBuildingTrait trait + * Test ExOrg\DatafilesParser\CoderBuildingTrait trait * has been implemented. */ public function testCoderBuildingTraitExists() { $this->assertTrue( - trait_exists('Exorg\DataCoder\CoderBuildingTrait') + trait_exists('ExOrg\DataCoder\CoderBuildingTrait') ); } @@ -50,7 +50,7 @@ public function testBuildCoderFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\CoderBuildingTrait', + 'ExOrg\DataCoder\CoderBuildingTrait', 'buildCoder' ) ); @@ -67,7 +67,7 @@ public function testBuildCoderFunctionExists() */ public function testBuildCoderWhenTraitUsingClassHasImproperPostfix($traitUsingClassObject) { - $this->expectException('\Exorg\DataCoder\CoderClassNotFoundException'); + $this->expectException('\ExOrg\DataCoder\CoderClassNotFoundException'); $traitUsingClassObject->runBuildCoder(); } @@ -82,7 +82,7 @@ public function testBuildCoderWhenTraitUsingClassHasImproperPostfix($traitUsingC */ public function testBuildCoderWhenTraitUsingClassHasImproperPrefix($traitUsingClassObject) { - $this->expectException('\Exorg\DataCoder\CoderClassNotFoundException'); + $this->expectException('\ExOrg\DataCoder\CoderClassNotFoundException'); $traitUsingClassObject->runBuildCoder(); } @@ -96,7 +96,7 @@ public function testBuildCoderWhenTraitUsingClassHasImproperPrefix($traitUsingCl */ public function testBuildCoderWhenTraitUsingClassHasImproperDataFormat($traitUsingClassObject) { - $this->expectException('\Exorg\DataCoder\CoderClassNotFoundException'); + $this->expectException('\ExOrg\DataCoder\CoderClassNotFoundException'); $traitUsingClassObject->runBuildCoder(); } diff --git a/tests/unit_tests/coder_builder/CoderClassNotFoundExceptionTest.php b/tests/unit_tests/coder_builder/CoderClassNotFoundExceptionTest.php index cc1f838..f63346c 100644 --- a/tests/unit_tests/coder_builder/CoderClassNotFoundExceptionTest.php +++ b/tests/unit_tests/coder_builder/CoderClassNotFoundExceptionTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; @@ -26,13 +26,13 @@ class CoderClassNotFoundExceptionTest extends TestCase { /** - * Test if Exorg\DataCoder\CoderClassNotFoundException class + * Test if ExOrg\DataCoder\CoderClassNotFoundException class * has been created. */ public function testCoderClassNotFoundExceptionClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\CoderClassNotFoundException') + class_exists('ExOrg\DataCoder\CoderClassNotFoundException') ); } } diff --git a/tests/unit_tests/coders/data_coders/data_decoders/DataDecoderTest.php b/tests/unit_tests/coders/data_coders/data_decoders/DataDecoderTest.php index 4d85bb3..6af9700 100644 --- a/tests/unit_tests/coders/data_coders/data_decoders/DataDecoderTest.php +++ b/tests/unit_tests/coders/data_coders/data_decoders/DataDecoderTest.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; -use Exorg\Decapsulator\ObjectDecapsulator; +use ExOrg\Decapsulator\ObjectDecapsulator; /** * DataDecoderTest. @@ -34,13 +34,13 @@ class DataDecoderTest extends TestCase private $dataDecoder; /** - * Test Exorg\DataCoder\DataDecoder class + * Test ExOrg\DataCoder\DataDecoder class * has been created. */ public function testDataDecoderClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\DataDecoder') + class_exists('ExOrg\DataCoder\DataDecoder') ); } @@ -52,7 +52,7 @@ public function testSetDataFormatFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\DataDecoder', + 'ExOrg\DataCoder\DataDecoder', 'setDataFormat' ) ); @@ -120,7 +120,7 @@ public function testDecodeDataFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\DataDecoder', + 'ExOrg\DataCoder\DataDecoder', 'decodeData' ) ); diff --git a/tests/unit_tests/coders/data_coders/data_decoders/JsonDataDecoderTest.php b/tests/unit_tests/coders/data_coders/data_decoders/JsonDataDecoderTest.php index 45e7982..9bebb4a 100644 --- a/tests/unit_tests/coders/data_coders/data_decoders/JsonDataDecoderTest.php +++ b/tests/unit_tests/coders/data_coders/data_decoders/JsonDataDecoderTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; @@ -51,7 +51,7 @@ class JsonDataDecoderTest extends TestCase public function testJsonDataDecoderClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\JsonDataDecoder') + class_exists('ExOrg\DataCoder\JsonDataDecoder') ); } @@ -63,7 +63,7 @@ public function testDecodeDataFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\JsonDataDecoder', + 'ExOrg\DataCoder\JsonDataDecoder', 'decodeData' ) ); @@ -89,7 +89,7 @@ public function testDecodeDataWithNotStringData() */ public function testDecodeDataWithDataInIncorrectFormat() { - $this->expectException('\Exorg\DataCoder\DataFormatInvalidException'); + $this->expectException('\ExOrg\DataCoder\DataFormatInvalidException'); $data = ''; diff --git a/tests/unit_tests/coders/data_coders/data_decoders/YamlDataDecoderTest.php b/tests/unit_tests/coders/data_coders/data_decoders/YamlDataDecoderTest.php index 9097358..668599b 100644 --- a/tests/unit_tests/coders/data_coders/data_decoders/YamlDataDecoderTest.php +++ b/tests/unit_tests/coders/data_coders/data_decoders/YamlDataDecoderTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; @@ -51,7 +51,7 @@ class YamlDataDecoderTest extends TestCase public function testYamlDataDecoderClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\YamlDataDecoder') + class_exists('ExOrg\DataCoder\YamlDataDecoder') ); } @@ -63,7 +63,7 @@ public function testDecodeDataFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\YamlDataDecoder', + 'ExOrg\DataCoder\YamlDataDecoder', 'decodeData' ) ); @@ -89,7 +89,7 @@ public function testDecodeDataWithNotStringData() */ public function testDecodeDataWithDataInIncorrectFormat() { - $this->expectException('\Exorg\DataCoder\DataFormatInvalidException'); + $this->expectException('\ExOrg\DataCoder\DataFormatInvalidException'); $data = ''; diff --git a/tests/unit_tests/coders/data_coders/data_encoders/DataEncoderTest.php b/tests/unit_tests/coders/data_coders/data_encoders/DataEncoderTest.php index 4aafac4..0877b21 100644 --- a/tests/unit_tests/coders/data_coders/data_encoders/DataEncoderTest.php +++ b/tests/unit_tests/coders/data_coders/data_encoders/DataEncoderTest.php @@ -9,9 +9,9 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; -use Exorg\Decapsulator\ObjectDecapsulator; +use ExOrg\Decapsulator\ObjectDecapsulator; use PHPUnit\Framework\TestCase; /** @@ -34,13 +34,13 @@ class DataEncoderTest extends TestCase private $dataEncoder; /** - * Test Exorg\DataCoder\DataEncoder class + * Test ExOrg\DataCoder\DataEncoder class * has been created. */ public function testDataEncoderClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\DataEncoder') + class_exists('ExOrg\DataCoder\DataEncoder') ); } @@ -52,7 +52,7 @@ public function testSetDataFormatFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\DataEncoder', + 'ExOrg\DataCoder\DataEncoder', 'setDataFormat' ) ); @@ -120,7 +120,7 @@ public function testEncodeDataFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\DataEncoder', + 'ExOrg\DataCoder\DataEncoder', 'encodeData' ) ); diff --git a/tests/unit_tests/coders/data_coders/data_encoders/JsonDataEncoderTest.php b/tests/unit_tests/coders/data_coders/data_encoders/JsonDataEncoderTest.php index 507b26e..70fc84a 100644 --- a/tests/unit_tests/coders/data_coders/data_encoders/JsonDataEncoderTest.php +++ b/tests/unit_tests/coders/data_coders/data_encoders/JsonDataEncoderTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; @@ -51,7 +51,7 @@ class JsonDataEncoderTest extends TestCase public function testJsonDataEncoderClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\JsonDataEncoder') + class_exists('ExOrg\DataCoder\JsonDataEncoder') ); } @@ -63,7 +63,7 @@ public function testEncodeDataFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\JsonDataEncoder', + 'ExOrg\DataCoder\JsonDataEncoder', 'encodeData' ) ); diff --git a/tests/unit_tests/coders/data_coders/data_encoders/YamlDataEncoderTest.php b/tests/unit_tests/coders/data_coders/data_encoders/YamlDataEncoderTest.php index cc5a10d..9a81e63 100644 --- a/tests/unit_tests/coders/data_coders/data_encoders/YamlDataEncoderTest.php +++ b/tests/unit_tests/coders/data_coders/data_encoders/YamlDataEncoderTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; @@ -51,7 +51,7 @@ class YamlDataEncoderTest extends TestCase public function testYamlDataEncoderClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\YamlDataEncoder') + class_exists('ExOrg\DataCoder\YamlDataEncoder') ); } @@ -63,7 +63,7 @@ public function testEncodeDataFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\YamlDataEncoder', + 'ExOrg\DataCoder\YamlDataEncoder', 'encodeData' ) ); diff --git a/tests/unit_tests/coders/datafile_coders/datafile_decoders/DatafileDecoderTest.php b/tests/unit_tests/coders/datafile_coders/datafile_decoders/DatafileDecoderTest.php index e3cb246..eac1f41 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_decoders/DatafileDecoderTest.php +++ b/tests/unit_tests/coders/datafile_coders/datafile_decoders/DatafileDecoderTest.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; -use Exorg\Decapsulator\ObjectDecapsulator; +use ExOrg\Decapsulator\ObjectDecapsulator; /** * DatafileDecoderTest. @@ -41,13 +41,13 @@ class DatafileDecoderTest extends TestCase private $datafileDecoder; /** - * Test Exorg\DataCoder\DatafileDecoder class + * Test ExOrg\DataCoder\DatafileDecoder class * has been created. */ public function testDatafileDecoderClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\DatafileDecoder') + class_exists('ExOrg\DataCoder\DatafileDecoder') ); } @@ -59,7 +59,7 @@ public function testSetDataFormatFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\DatafileDecoder', + 'ExOrg\DataCoder\DatafileDecoder', 'setDataFormat' ) ); @@ -128,7 +128,7 @@ public function testDecodeFileFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\DatafileDecoder', + 'ExOrg\DataCoder\DatafileDecoder', 'decodeFile' ) ); @@ -140,7 +140,7 @@ public function testDecodeFileFunctionExists() */ public function testDecodeFileWhenFileDoesNotExist() { - $this->expectException('\Exorg\DataCoder\FileException'); + $this->expectException('\ExOrg\DataCoder\FileException'); $dataFilePath = self::$dataFileFixturesHelper->buildEncodedFilePath('noexistent.format'); @@ -153,7 +153,7 @@ public function testDecodeFileWhenFileDoesNotExist() */ public function testDecodeFileWhenImproperDataFormatIsSet() { - $this->expectException('\Exorg\DataCoder\CoderClassNotFoundException'); + $this->expectException('\ExOrg\DataCoder\CoderClassNotFoundException'); $dataFilePath = self::$dataFileFixturesHelper->buildEncodedFilePath('data.format'); @@ -185,7 +185,7 @@ public function testDecodeFileWhenDataFormatIsSet() */ public function testDecodeFileWhenDataFormatIsNotSetAndFileHasImproperExtension() { - $this->expectException('\Exorg\DataCoder\CoderClassNotFoundException'); + $this->expectException('\ExOrg\DataCoder\CoderClassNotFoundException'); $dataFilePath = self::$dataFileFixturesHelper->buildEncodedFilePath('data.nonexistentformat'); diff --git a/tests/unit_tests/coders/datafile_coders/datafile_decoders/JsonDatafileDecoderTest.php b/tests/unit_tests/coders/datafile_coders/datafile_decoders/JsonDatafileDecoderTest.php index a93d89f..8d530ef 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_decoders/JsonDatafileDecoderTest.php +++ b/tests/unit_tests/coders/datafile_coders/datafile_decoders/JsonDatafileDecoderTest.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; -use Exorg\Decapsulator\ObjectDecapsulator; +use ExOrg\Decapsulator\ObjectDecapsulator; /** * JsonDatafileDecoderTest. @@ -46,13 +46,13 @@ class JsonDatafileDecoderTest extends TestCase private $jsonDatafileDecoder; /** - * Test Exorg\DataCoder\JsonDatafileDecoder class + * Test ExOrg\DataCoder\JsonDatafileDecoder class * has been created. */ public function testJsonDatafileDecoderClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\JsonDatafileDecoder') + class_exists('ExOrg\DataCoder\JsonDatafileDecoder') ); } @@ -64,7 +64,7 @@ public function testDecodeFileFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\JsonDatafileDecoder', + 'ExOrg\DataCoder\JsonDatafileDecoder', 'decodeFile' ) ); @@ -76,7 +76,7 @@ public function testDecodeFileFunctionExists() */ public function testDecodeFileWhenFileDoesNotExist() { - $this->expectException('\Exorg\DataCoder\FileException'); + $this->expectException('\ExOrg\DataCoder\FileException'); $dataFilePath = self::$dataFileFixturesHelper->buildEncodedFilePath('noexistent.format'); @@ -89,7 +89,7 @@ public function testDecodeFileWhenFileDoesNotExist() */ public function testDecodeFileWithIncorrectData() { - $this->expectException('\Exorg\DataCoder\DataFormatInvalidException'); + $this->expectException('\ExOrg\DataCoder\DataFormatInvalidException'); $dataFilePath = self::$dataFileFixturesHelper->buildEncodedFilePath('data.nonexistentformat'); diff --git a/tests/unit_tests/coders/datafile_coders/datafile_decoders/YamlDatafileDecoderTest.php b/tests/unit_tests/coders/datafile_coders/datafile_decoders/YamlDatafileDecoderTest.php index 8112d66..2c45b84 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_decoders/YamlDatafileDecoderTest.php +++ b/tests/unit_tests/coders/datafile_coders/datafile_decoders/YamlDatafileDecoderTest.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; -use Exorg\Decapsulator\ObjectDecapsulator; +use ExOrg\Decapsulator\ObjectDecapsulator; /** * YamlDatafileDecoderTest. @@ -46,13 +46,13 @@ class YamlDatafileDecoderTest extends TestCase private $yamlDatafileDecoder; /** - * Test Exorg\DataCoder\YamlDatafileDecoder class + * Test ExOrg\DataCoder\YamlDatafileDecoder class * has been created. */ public function testYamlDatafileDecoderClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\YamlDatafileDecoder') + class_exists('ExOrg\DataCoder\YamlDatafileDecoder') ); } @@ -64,7 +64,7 @@ public function testDecodeFileFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\YamlDatafileDecoder', + 'ExOrg\DataCoder\YamlDatafileDecoder', 'decodeFile' ) ); @@ -76,7 +76,7 @@ public function testDecodeFileFunctionExists() */ public function testDecodeFileWhenFileDoesNotExist() { - $this->expectException('\Exorg\DataCoder\FileException'); + $this->expectException('\ExOrg\DataCoder\FileException'); $dataFilePath = self::$dataFileFixturesHelper->buildEncodedFilePath('noexistent.format'); @@ -89,7 +89,7 @@ public function testDecodeFileWhenFileDoesNotExist() */ public function testDecodeFileWithIncorrectData() { - $this->expectException('\Exorg\DataCoder\DataFormatInvalidException'); + $this->expectException('\ExOrg\DataCoder\DataFormatInvalidException'); $dataFilePath = self::$dataFileFixturesHelper->buildEncodedFilePath('data.nonexistentformat'); diff --git a/tests/unit_tests/coders/datafile_coders/datafile_encoders/DatafileEncoderTest.php b/tests/unit_tests/coders/datafile_coders/datafile_encoders/DatafileEncoderTest.php index bce1952..425c3c0 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_encoders/DatafileEncoderTest.php +++ b/tests/unit_tests/coders/datafile_coders/datafile_encoders/DatafileEncoderTest.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; -use Exorg\Decapsulator\ObjectDecapsulator; +use ExOrg\Decapsulator\ObjectDecapsulator; /** * DatafileEncoderTest. @@ -41,13 +41,13 @@ class DatafileEncoderTest extends TestCase private $datafileEncoder; /** - * Test Exorg\DataCoder\DatafileEncoder class + * Test ExOrg\DataCoder\DatafileEncoder class * has been created. */ public function testDatafileEncoderClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\DatafileEncoder') + class_exists('ExOrg\DataCoder\DatafileEncoder') ); } @@ -59,7 +59,7 @@ public function testSetDataFormatFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\DatafileEncoder', + 'ExOrg\DataCoder\DatafileEncoder', 'setDataFormat' ) ); @@ -130,7 +130,7 @@ public function testEncodeFileFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\DatafileEncoder', + 'ExOrg\DataCoder\DatafileEncoder', 'encodeFile' ) ); @@ -142,7 +142,7 @@ public function testEncodeFileFunctionExists() */ public function testEncodeFileWhenImproperDataFormatIsSet() { - $this->expectException('\Exorg\DataCoder\CoderClassNotFoundException'); + $this->expectException('\ExOrg\DataCoder\CoderClassNotFoundException'); $dataFilePath = self::$dataFileFixturesHelper->buildCreatedFilePath('data.format'); @@ -176,7 +176,7 @@ public function testEncodeFileWhenDataFormatIsSet() */ public function testEncodeFileWhenDataFormatIsNotSetAndFileHasImproperExtension() { - $this->expectException('\Exorg\DataCoder\CoderClassNotFoundException'); + $this->expectException('\ExOrg\DataCoder\CoderClassNotFoundException'); $dataFilePath = self::$dataFileFixturesHelper->buildCreatedFilePath('data.nonexistentformat'); diff --git a/tests/unit_tests/coders/datafile_coders/datafile_encoders/JsonDatafileEncoderTest.php b/tests/unit_tests/coders/datafile_coders/datafile_encoders/JsonDatafileEncoderTest.php index bd67171..3efeb9c 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_encoders/JsonDatafileEncoderTest.php +++ b/tests/unit_tests/coders/datafile_coders/datafile_encoders/JsonDatafileEncoderTest.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; -use Exorg\Decapsulator\ObjectDecapsulator; +use ExOrg\Decapsulator\ObjectDecapsulator; /** * JsonDatafileEncoderTest. @@ -46,13 +46,13 @@ class JsonDatafileEncoderTest extends TestCase private $jsonDatafileEncoder; /** - * Test Exorg\DataCoder\JsonDatafileEncoder class + * Test ExOrg\DataCoder\JsonDatafileEncoder class * has been created. */ public function testJsonDatafileEncoderClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\JsonDatafileEncoder') + class_exists('ExOrg\DataCoder\JsonDatafileEncoder') ); } @@ -64,7 +64,7 @@ public function testEncodeFileFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\JsonDatafileEncoder', + 'ExOrg\DataCoder\JsonDatafileEncoder', 'encodeFile' ) ); diff --git a/tests/unit_tests/coders/datafile_coders/datafile_encoders/YamlDatafileEncoderTest.php b/tests/unit_tests/coders/datafile_coders/datafile_encoders/YamlDatafileEncoderTest.php index 1db4b72..f7e717f 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_encoders/YamlDatafileEncoderTest.php +++ b/tests/unit_tests/coders/datafile_coders/datafile_encoders/YamlDatafileEncoderTest.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; -use Exorg\Decapsulator\ObjectDecapsulator; +use ExOrg\Decapsulator\ObjectDecapsulator; /** * YamlDatafileEncoderTest. @@ -46,13 +46,13 @@ class YamlDatafileEncoderTest extends TestCase private $yamlDatafileEncoder; /** - * Test Exorg\DataCoder\YamlDatafileEncoder class + * Test ExOrg\DataCoder\YamlDatafileEncoder class * has been created. */ public function testYamlDatafileEncoderClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\YamlDatafileEncoder') + class_exists('ExOrg\DataCoder\YamlDatafileEncoder') ); } @@ -64,7 +64,7 @@ public function testEncodeFileFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\YamlDatafileEncoder', + 'ExOrg\DataCoder\YamlDatafileEncoder', 'encodeFile' ) ); diff --git a/tests/unit_tests/data_format/DataFormatInvalidExceptionTest.php b/tests/unit_tests/data_format/DataFormatInvalidExceptionTest.php index 39ae77f..08fb1bc 100644 --- a/tests/unit_tests/data_format/DataFormatInvalidExceptionTest.php +++ b/tests/unit_tests/data_format/DataFormatInvalidExceptionTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; @@ -26,13 +26,13 @@ class DataFormatInvalidExceptionTest extends TestCase { /** - * Test if Exorg\DataCoder\DataFormatInvalidException class + * Test if ExOrg\DataCoder\DataFormatInvalidException class * has been created. */ public function testDataFormatInvalidExceptionClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\DataFormatInvalidException') + class_exists('ExOrg\DataCoder\DataFormatInvalidException') ); } } diff --git a/tests/unit_tests/data_format/DataFormatTest.php b/tests/unit_tests/data_format/DataFormatTest.php index de317a2..84eefad 100644 --- a/tests/unit_tests/data_format/DataFormatTest.php +++ b/tests/unit_tests/data_format/DataFormatTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; @@ -26,13 +26,13 @@ class DataFormatTest extends TestCase { /** - * Test Exorg\DatafilesParser\DataFormat enum + * Test ExOrg\DatafilesParser\DataFormat enum * has been implemented. */ public function testDataFormatExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\DataFormat') + class_exists('ExOrg\DataCoder\DataFormat') ); } @@ -47,7 +47,7 @@ class_exists('Exorg\DataCoder\DataFormat') */ public function testDataFormatsItems($formatAbbreviation, $expectedFormatFullName) { - $actualFormatFullName = constant("Exorg\DataCoder\DataFormat::$formatAbbreviation"); + $actualFormatFullName = constant("ExOrg\DataCoder\DataFormat::$formatAbbreviation"); $this->assertEquals($expectedFormatFullName, $actualFormatFullName); } diff --git a/tests/unit_tests/file/FileExceptionTest.php b/tests/unit_tests/file/FileExceptionTest.php index 4879259..a7cfe59 100644 --- a/tests/unit_tests/file/FileExceptionTest.php +++ b/tests/unit_tests/file/FileExceptionTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; @@ -26,13 +26,13 @@ class FileExceptionTest extends TestCase { /** - * Test if Exorg\DataCoder\NonexistentFileException class + * Test if ExOrg\DataCoder\NonexistentFileException class * has been created. */ public function testFileExceptionTestClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\FileException') + class_exists('ExOrg\DataCoder\FileException') ); } } diff --git a/tests/unit_tests/file/FileTest.php b/tests/unit_tests/file/FileTest.php index c6695a9..9f11a4d 100644 --- a/tests/unit_tests/file/FileTest.php +++ b/tests/unit_tests/file/FileTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Exorg\DataCoder; +namespace ExOrg\DataCoder; use PHPUnit\Framework\TestCase; @@ -46,13 +46,13 @@ public function testSelfBuildFileFixturePath() } /** - * Test if Exorg\DataCoder\File class + * Test if ExOrg\DataCoder\File class * has been created. */ public function testFileClassExists() { $this->assertTrue( - class_exists('Exorg\DataCoder\File') + class_exists('ExOrg\DataCoder\File') ); } @@ -106,7 +106,7 @@ public function testConstructorWhenFileDoesNotExist() $file = new File($filePath); - $this->assertInstanceOf('Exorg\DataCoder\File', $file); + $this->assertInstanceOf('ExOrg\DataCoder\File', $file); } /** @@ -119,7 +119,7 @@ public function testConstructorWhenFileExists() $file = new File($filePath); - $this->assertInstanceOf('Exorg\DataCoder\File', $file); + $this->assertInstanceOf('ExOrg\DataCoder\File', $file); } /** @@ -130,7 +130,7 @@ public function testGetExtensionFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\File', + 'ExOrg\DataCoder\File', 'getExtension' ) ); @@ -157,7 +157,7 @@ public function testGetContentFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\File', + 'ExOrg\DataCoder\File', 'getContent' ) ); @@ -169,7 +169,7 @@ public function testGetContentFunctionExists() */ public function testGetContentWhenFileDoesNotExist() { - $this->expectException('\Exorg\DataCoder\FileException'); + $this->expectException('\ExOrg\DataCoder\FileException'); $filePath = self::buildFileFixturePath('nonexistent'); @@ -184,7 +184,7 @@ public function testGetContentWhenFileDoesNotExist() */ public function testGetContentWhenFileIsNotReadable() { - $this->expectException('\Exorg\DataCoder\FileException'); + $this->expectException('\ExOrg\DataCoder\FileException'); $filePath = self::buildFileFixturePath('unreadable-file'); @@ -199,7 +199,7 @@ public function testGetContentWhenFileIsNotReadable() */ public function testGetContentWhenDirectoryIsNotReadable() { - $this->expectException('\Exorg\DataCoder\FileException'); + $this->expectException('\ExOrg\DataCoder\FileException'); $filePath = self::buildFileFixturePath('unreadable-directory/file-for-read'); @@ -229,7 +229,7 @@ public function testSetContentFunctionExists() { $this->assertTrue( method_exists( - 'Exorg\DataCoder\File', + 'ExOrg\DataCoder\File', 'setContent' ) ); @@ -256,7 +256,7 @@ public function testSetContentWhenContentIsImproper($content) */ public function testSetContentWhenFileIsNotWritable() { - $this->expectException('\Exorg\DataCoder\FileException'); + $this->expectException('\ExOrg\DataCoder\FileException'); $filePath = self::buildFileFixturePath('unwritable-file'); @@ -271,7 +271,7 @@ public function testSetContentWhenFileIsNotWritable() */ public function testSetContentWhenDirectoryIsNotWritable() { - $this->expectException('\Exorg\DataCoder\FileException'); + $this->expectException('\ExOrg\DataCoder\FileException'); $filePath = self::buildFileFixturePath('unwritable-directory/file-for-write'); From e95f48ad8e2a4a0671401fc200d986763135cc50 Mon Sep 17 00:00:00 2001 From: katheroine Date: Tue, 7 Nov 2023 19:53:23 +0100 Subject: [PATCH 02/26] ExOrg\DataCoder\File fully qualified namespace changed to ExOrg\DataCoder\File\File, class file path updated (ExOrg#107) --- composer.json | 11 ++----- src/{file => File}/File.php | 2 +- src/{file => File}/FileException.php | 4 +-- .../{file => File}/FileExceptionTest.php | 6 ++-- tests/unit_tests/{file => File}/FileTest.php | 29 ++++++++++--------- 5 files changed, 26 insertions(+), 26 deletions(-) rename src/{file => File}/File.php (99%) rename src/{file => File}/FileException.php (92%) rename tests/unit_tests/{file => File}/FileExceptionTest.php (81%) rename tests/unit_tests/{file => File}/FileTest.php (92%) diff --git a/composer.json b/composer.json index 3a06930..75db006 100644 --- a/composer.json +++ b/composer.json @@ -38,18 +38,14 @@ "src/coders/datafile_coders/datafile_encoders/", "src/coders/datafile_coders/datafile_decoders/", "src/data_format/", - "src/coder_builder/", - "src/file/" + "src/coder_builder/" ] } }, "autoload-dev": { "psr-4": { "ExOrg\\DataCoder\\": [ - "tests/", - "tests/testing_environment/", - "tests/testing_environment/helpers/", - "tests/testing_environment/classes/", + "tests/unit_tests/", "tests/unit_tests/coders/", "tests/unit_tests/coders/data_coders/", "tests/unit_tests/coders/data_coders/data_encoders/", @@ -58,8 +54,7 @@ "tests/unit_tests/coders/datafile_coders/datafile_encoders/", "tests/unit_tests/coders/datafile_coders/datafile_decoders/", "tests/unit_tests/data_format/", - "tests/unit_tests/coder_builder/", - "tests/unit_tests/file/" + "tests/unit_tests/coder_builder/" ] } }, diff --git a/src/file/File.php b/src/File/File.php similarity index 99% rename from src/file/File.php rename to src/File/File.php index 34b9598..e67d756 100644 --- a/src/file/File.php +++ b/src/File/File.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\File; /** * File. diff --git a/src/file/FileException.php b/src/File/FileException.php similarity index 92% rename from src/file/FileException.php rename to src/File/FileException.php index 4b2c2b4..bb44e52 100644 --- a/src/file/FileException.php +++ b/src/File/FileException.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\File; /** - * NonexistentFileException. + * FileException. * Exception indicating that file * either doesn't exist * or cannot be read from the given place diff --git a/tests/unit_tests/file/FileExceptionTest.php b/tests/unit_tests/File/FileExceptionTest.php similarity index 81% rename from tests/unit_tests/file/FileExceptionTest.php rename to tests/unit_tests/File/FileExceptionTest.php index a7cfe59..41f045a 100644 --- a/tests/unit_tests/file/FileExceptionTest.php +++ b/tests/unit_tests/File/FileExceptionTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\File; use PHPUnit\Framework\TestCase; @@ -25,6 +25,8 @@ */ class FileExceptionTest extends TestCase { + const FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\File\FileException'; + /** * Test if ExOrg\DataCoder\NonexistentFileException class * has been created. @@ -32,7 +34,7 @@ class FileExceptionTest extends TestCase public function testFileExceptionTestClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\FileException') + class_exists(self::FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME) ); } } diff --git a/tests/unit_tests/file/FileTest.php b/tests/unit_tests/File/FileTest.php similarity index 92% rename from tests/unit_tests/file/FileTest.php rename to tests/unit_tests/File/FileTest.php index 9f11a4d..5bc3faa 100644 --- a/tests/unit_tests/file/FileTest.php +++ b/tests/unit_tests/File/FileTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\File; use PHPUnit\Framework\TestCase; @@ -31,6 +31,9 @@ class FileTest extends TestCase */ const FILE_FIXTURES_RELATIVE_PATH = '../../testing_environment/files'; + const FILE_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\File\File'; + const FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\File\FileException'; + /** * Self-test for function buildFileFixturePath. */ @@ -46,13 +49,13 @@ public function testSelfBuildFileFixturePath() } /** - * Test if ExOrg\DataCoder\File class + * Test if File class * has been created. */ public function testFileClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\File') + class_exists(self::FILE_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -106,7 +109,7 @@ public function testConstructorWhenFileDoesNotExist() $file = new File($filePath); - $this->assertInstanceOf('ExOrg\DataCoder\File', $file); + $this->assertInstanceOf(self::FILE_FULLY_QUALIFIED_CLASS_NAME, $file); } /** @@ -119,7 +122,7 @@ public function testConstructorWhenFileExists() $file = new File($filePath); - $this->assertInstanceOf('ExOrg\DataCoder\File', $file); + $this->assertInstanceOf(self::FILE_FULLY_QUALIFIED_CLASS_NAME, $file); } /** @@ -130,7 +133,7 @@ public function testGetExtensionFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\File', + self::FILE_FULLY_QUALIFIED_CLASS_NAME, 'getExtension' ) ); @@ -157,7 +160,7 @@ public function testGetContentFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\File', + self::FILE_FULLY_QUALIFIED_CLASS_NAME, 'getContent' ) ); @@ -169,7 +172,7 @@ public function testGetContentFunctionExists() */ public function testGetContentWhenFileDoesNotExist() { - $this->expectException('\ExOrg\DataCoder\FileException'); + $this->expectException(self::FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $filePath = self::buildFileFixturePath('nonexistent'); @@ -184,7 +187,7 @@ public function testGetContentWhenFileDoesNotExist() */ public function testGetContentWhenFileIsNotReadable() { - $this->expectException('\ExOrg\DataCoder\FileException'); + $this->expectException(self::FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $filePath = self::buildFileFixturePath('unreadable-file'); @@ -199,7 +202,7 @@ public function testGetContentWhenFileIsNotReadable() */ public function testGetContentWhenDirectoryIsNotReadable() { - $this->expectException('\ExOrg\DataCoder\FileException'); + $this->expectException(self::FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $filePath = self::buildFileFixturePath('unreadable-directory/file-for-read'); @@ -229,7 +232,7 @@ public function testSetContentFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\File', + self::FILE_FULLY_QUALIFIED_CLASS_NAME, 'setContent' ) ); @@ -256,7 +259,7 @@ public function testSetContentWhenContentIsImproper($content) */ public function testSetContentWhenFileIsNotWritable() { - $this->expectException('\ExOrg\DataCoder\FileException'); + $this->expectException(self::FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $filePath = self::buildFileFixturePath('unwritable-file'); @@ -271,7 +274,7 @@ public function testSetContentWhenFileIsNotWritable() */ public function testSetContentWhenDirectoryIsNotWritable() { - $this->expectException('\ExOrg\DataCoder\FileException'); + $this->expectException(self::FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $filePath = self::buildFileFixturePath('unwritable-directory/file-for-write'); From 8e022b7ca35427e05ce3b1f1fe1dd54a2e084a95 Mon Sep 17 00:00:00 2001 From: katheroine Date: Wed, 8 Nov 2023 11:00:45 +0100 Subject: [PATCH 03/26] ExOrg\DataCoder\CoderBuildingTrait fully qualified namespace changed to ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait, class file path updated (ExOrg#107) --- composer.json | 9 +++++---- .../CoderBuildingTrait.php | 2 +- .../CoderClassNotFoundException.php | 2 +- .../classes/DummyClassFormat1Decoder.php | 2 +- .../classes/DummyClassFormat1Encoder.php | 2 +- .../classes/DummyClassFormat1Nocoder.php | 2 +- .../classes/DummyClassFormat2Decoder.php | 2 +- .../classes/DummyClassFormat2Encoder.php | 2 +- .../classes/DummyClassFormat2Nocoder.php | 2 +- .../DummyClassFormatNotRecognizedDecoder.php | 2 +- .../DummyClassFormatNotRecognizedEncoder.php | 2 +- .../classes/DummyClassFormatNullDecoder.php | 2 +- .../classes/DummyClassFormatNullEncoder.php | 2 +- .../classes/Format1DataDecoder.php | 2 +- .../classes/Format1DataEncoder.php | 2 +- .../classes/Format1DummyClassDecoder.php | 2 +- .../classes/Format1DummyClassEncoder.php | 2 +- .../classes/Format1DummyClassNocoder.php | 2 +- .../classes/Format2DataDecoder.php | 2 +- .../classes/Format2DataEncoder.php | 2 +- .../classes/Format2DummyClassDecoder.php | 2 +- .../classes/Format2DummyClassEncoder.php | 2 +- .../classes/Format2DummyClassNocoder.php | 2 +- .../classes/Format3DataDecoder.php | 2 +- .../classes/Format3DataEncoder.php | 2 +- .../classes/FormatDataDecoder.php | 2 +- .../classes/FormatDataEncoder.php | 2 +- .../FormatnotrecognizedDummyClassDecoder.php | 2 +- .../FormatnotrecognizedDummyClassEncoder.php | 2 +- .../CoderBuildingTraitTest.php | 15 +++++++++------ .../CoderClassNotFoundExceptionTest.php | 0 31 files changed, 42 insertions(+), 38 deletions(-) rename src/{coder_builder => CoderBuilder}/CoderBuildingTrait.php (99%) rename src/{coder_builder => CoderBuilder}/CoderClassNotFoundException.php (94%) rename tests/unit_tests/{coder_builder => CoderBuilder}/CoderBuildingTraitTest.php (89%) rename tests/unit_tests/{coder_builder => CoderBuilder}/CoderClassNotFoundExceptionTest.php (100%) diff --git a/composer.json b/composer.json index 75db006..2023b91 100644 --- a/composer.json +++ b/composer.json @@ -37,8 +37,7 @@ "src/coders/datafile_coders/", "src/coders/datafile_coders/datafile_encoders/", "src/coders/datafile_coders/datafile_decoders/", - "src/data_format/", - "src/coder_builder/" + "src/data_format/" ] } }, @@ -53,8 +52,10 @@ "tests/unit_tests/coders/datafile_coders/", "tests/unit_tests/coders/datafile_coders/datafile_encoders/", "tests/unit_tests/coders/datafile_coders/datafile_decoders/", - "tests/unit_tests/data_format/", - "tests/unit_tests/coder_builder/" + "tests/unit_tests/data_format/" + ], + "ExOrg\\DataCoder\\CoderBuilder\\": [ + "tests/testing_environment/classes" ] } }, diff --git a/src/coder_builder/CoderBuildingTrait.php b/src/CoderBuilder/CoderBuildingTrait.php similarity index 99% rename from src/coder_builder/CoderBuildingTrait.php rename to src/CoderBuilder/CoderBuildingTrait.php index fb8c69f..83419da 100644 --- a/src/coder_builder/CoderBuildingTrait.php +++ b/src/CoderBuilder/CoderBuildingTrait.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * CoderBuildingTrait. diff --git a/src/coder_builder/CoderClassNotFoundException.php b/src/CoderBuilder/CoderClassNotFoundException.php similarity index 94% rename from src/coder_builder/CoderClassNotFoundException.php rename to src/CoderBuilder/CoderClassNotFoundException.php index f4c13cf..6c909d6 100644 --- a/src/coder_builder/CoderClassNotFoundException.php +++ b/src/CoderBuilder/CoderClassNotFoundException.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * CoderClassNotFoundException. diff --git a/tests/testing_environment/classes/DummyClassFormat1Decoder.php b/tests/testing_environment/classes/DummyClassFormat1Decoder.php index 07b32ab..04e9fc8 100644 --- a/tests/testing_environment/classes/DummyClassFormat1Decoder.php +++ b/tests/testing_environment/classes/DummyClassFormat1Decoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormat1Encoder.php b/tests/testing_environment/classes/DummyClassFormat1Encoder.php index 9302fce..3dbd44f 100644 --- a/tests/testing_environment/classes/DummyClassFormat1Encoder.php +++ b/tests/testing_environment/classes/DummyClassFormat1Encoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormat1Nocoder.php b/tests/testing_environment/classes/DummyClassFormat1Nocoder.php index 634ffd6..6df0b6f 100644 --- a/tests/testing_environment/classes/DummyClassFormat1Nocoder.php +++ b/tests/testing_environment/classes/DummyClassFormat1Nocoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormat2Decoder.php b/tests/testing_environment/classes/DummyClassFormat2Decoder.php index 5131697..da62aab 100644 --- a/tests/testing_environment/classes/DummyClassFormat2Decoder.php +++ b/tests/testing_environment/classes/DummyClassFormat2Decoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormat2Encoder.php b/tests/testing_environment/classes/DummyClassFormat2Encoder.php index be87fd3..15bbf86 100644 --- a/tests/testing_environment/classes/DummyClassFormat2Encoder.php +++ b/tests/testing_environment/classes/DummyClassFormat2Encoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormat2Nocoder.php b/tests/testing_environment/classes/DummyClassFormat2Nocoder.php index e676f1a..5de0aeb 100644 --- a/tests/testing_environment/classes/DummyClassFormat2Nocoder.php +++ b/tests/testing_environment/classes/DummyClassFormat2Nocoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormatNotRecognizedDecoder.php b/tests/testing_environment/classes/DummyClassFormatNotRecognizedDecoder.php index 627bf54..6b2e504 100644 --- a/tests/testing_environment/classes/DummyClassFormatNotRecognizedDecoder.php +++ b/tests/testing_environment/classes/DummyClassFormatNotRecognizedDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormatNotRecognizedEncoder.php b/tests/testing_environment/classes/DummyClassFormatNotRecognizedEncoder.php index 48b61d5..01734ee 100644 --- a/tests/testing_environment/classes/DummyClassFormatNotRecognizedEncoder.php +++ b/tests/testing_environment/classes/DummyClassFormatNotRecognizedEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormatNullDecoder.php b/tests/testing_environment/classes/DummyClassFormatNullDecoder.php index ea7258b..f88a16e 100644 --- a/tests/testing_environment/classes/DummyClassFormatNullDecoder.php +++ b/tests/testing_environment/classes/DummyClassFormatNullDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormatNullEncoder.php b/tests/testing_environment/classes/DummyClassFormatNullEncoder.php index a55720a..312be97 100644 --- a/tests/testing_environment/classes/DummyClassFormatNullEncoder.php +++ b/tests/testing_environment/classes/DummyClassFormatNullEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format1DataDecoder.php b/tests/testing_environment/classes/Format1DataDecoder.php index 0ba1fdd..e64107e 100644 --- a/tests/testing_environment/classes/Format1DataDecoder.php +++ b/tests/testing_environment/classes/Format1DataDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy data decoder for testing purposes only. diff --git a/tests/testing_environment/classes/Format1DataEncoder.php b/tests/testing_environment/classes/Format1DataEncoder.php index c56fbe3..2733d35 100644 --- a/tests/testing_environment/classes/Format1DataEncoder.php +++ b/tests/testing_environment/classes/Format1DataEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy data encoder for testing purposes only. diff --git a/tests/testing_environment/classes/Format1DummyClassDecoder.php b/tests/testing_environment/classes/Format1DummyClassDecoder.php index 9402244..8b315a4 100644 --- a/tests/testing_environment/classes/Format1DummyClassDecoder.php +++ b/tests/testing_environment/classes/Format1DummyClassDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format1DummyClassEncoder.php b/tests/testing_environment/classes/Format1DummyClassEncoder.php index e80bfa7..c970dd8 100644 --- a/tests/testing_environment/classes/Format1DummyClassEncoder.php +++ b/tests/testing_environment/classes/Format1DummyClassEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format1DummyClassNocoder.php b/tests/testing_environment/classes/Format1DummyClassNocoder.php index 89cd308..4bfffe2 100644 --- a/tests/testing_environment/classes/Format1DummyClassNocoder.php +++ b/tests/testing_environment/classes/Format1DummyClassNocoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format2DataDecoder.php b/tests/testing_environment/classes/Format2DataDecoder.php index ee97396..7f9454f 100644 --- a/tests/testing_environment/classes/Format2DataDecoder.php +++ b/tests/testing_environment/classes/Format2DataDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy data decoder for testing purposes only. diff --git a/tests/testing_environment/classes/Format2DataEncoder.php b/tests/testing_environment/classes/Format2DataEncoder.php index 76e23ff..7d03842 100644 --- a/tests/testing_environment/classes/Format2DataEncoder.php +++ b/tests/testing_environment/classes/Format2DataEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy data encoder for testing purposes only. diff --git a/tests/testing_environment/classes/Format2DummyClassDecoder.php b/tests/testing_environment/classes/Format2DummyClassDecoder.php index 9901632..af220a3 100644 --- a/tests/testing_environment/classes/Format2DummyClassDecoder.php +++ b/tests/testing_environment/classes/Format2DummyClassDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format2DummyClassEncoder.php b/tests/testing_environment/classes/Format2DummyClassEncoder.php index 3ee952d..ac4163a 100644 --- a/tests/testing_environment/classes/Format2DummyClassEncoder.php +++ b/tests/testing_environment/classes/Format2DummyClassEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format2DummyClassNocoder.php b/tests/testing_environment/classes/Format2DummyClassNocoder.php index 55ae4e2..2f3b213 100644 --- a/tests/testing_environment/classes/Format2DummyClassNocoder.php +++ b/tests/testing_environment/classes/Format2DummyClassNocoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format3DataDecoder.php b/tests/testing_environment/classes/Format3DataDecoder.php index 5be5449..436d55f 100644 --- a/tests/testing_environment/classes/Format3DataDecoder.php +++ b/tests/testing_environment/classes/Format3DataDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy data decoder for testing purposes only. diff --git a/tests/testing_environment/classes/Format3DataEncoder.php b/tests/testing_environment/classes/Format3DataEncoder.php index 173b5fe..1ac905f 100644 --- a/tests/testing_environment/classes/Format3DataEncoder.php +++ b/tests/testing_environment/classes/Format3DataEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy data encoder for testing purposes only. diff --git a/tests/testing_environment/classes/FormatDataDecoder.php b/tests/testing_environment/classes/FormatDataDecoder.php index 1775910..bc74b71 100644 --- a/tests/testing_environment/classes/FormatDataDecoder.php +++ b/tests/testing_environment/classes/FormatDataDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * FormatDataDecoder. diff --git a/tests/testing_environment/classes/FormatDataEncoder.php b/tests/testing_environment/classes/FormatDataEncoder.php index 76f8549..38d41ab 100644 --- a/tests/testing_environment/classes/FormatDataEncoder.php +++ b/tests/testing_environment/classes/FormatDataEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * FormatDataEncoder. diff --git a/tests/testing_environment/classes/FormatnotrecognizedDummyClassDecoder.php b/tests/testing_environment/classes/FormatnotrecognizedDummyClassDecoder.php index 02eef99..055a145 100644 --- a/tests/testing_environment/classes/FormatnotrecognizedDummyClassDecoder.php +++ b/tests/testing_environment/classes/FormatnotrecognizedDummyClassDecoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/FormatnotrecognizedDummyClassEncoder.php b/tests/testing_environment/classes/FormatnotrecognizedDummyClassEncoder.php index 25f26e1..2f684c4 100644 --- a/tests/testing_environment/classes/FormatnotrecognizedDummyClassEncoder.php +++ b/tests/testing_environment/classes/FormatnotrecognizedDummyClassEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; /** * Dummy class for testing diff --git a/tests/unit_tests/coder_builder/CoderBuildingTraitTest.php b/tests/unit_tests/CoderBuilder/CoderBuildingTraitTest.php similarity index 89% rename from tests/unit_tests/coder_builder/CoderBuildingTraitTest.php rename to tests/unit_tests/CoderBuilder/CoderBuildingTraitTest.php index 3d2edc5..6ed23c7 100644 --- a/tests/unit_tests/coder_builder/CoderBuildingTraitTest.php +++ b/tests/unit_tests/CoderBuilder/CoderBuildingTraitTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\CoderBuilder; use PHPUnit\Framework\TestCase; @@ -31,6 +31,9 @@ class CoderBuildingTraitTest extends TestCase */ const DUMMY_CODERS_NAMESPACE = __NAMESPACE__; + const CODE_BUILDING_TRAIT_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait'; + const CODER_CLASS_NOT_FOUND_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\CoderBuilder\CoderClassNotFoundException'; + /** * Test ExOrg\DatafilesParser\CoderBuildingTrait trait * has been implemented. @@ -38,7 +41,7 @@ class CoderBuildingTraitTest extends TestCase public function testCoderBuildingTraitExists() { $this->assertTrue( - trait_exists('ExOrg\DataCoder\CoderBuildingTrait') + trait_exists(self::CODE_BUILDING_TRAIT_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -50,7 +53,7 @@ public function testBuildCoderFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\CoderBuildingTrait', + self::CODE_BUILDING_TRAIT_FULLY_QUALIFIED_CLASS_NAME, 'buildCoder' ) ); @@ -67,7 +70,7 @@ public function testBuildCoderFunctionExists() */ public function testBuildCoderWhenTraitUsingClassHasImproperPostfix($traitUsingClassObject) { - $this->expectException('\ExOrg\DataCoder\CoderClassNotFoundException'); + $this->expectException(self::CODER_CLASS_NOT_FOUND_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $traitUsingClassObject->runBuildCoder(); } @@ -82,7 +85,7 @@ public function testBuildCoderWhenTraitUsingClassHasImproperPostfix($traitUsingC */ public function testBuildCoderWhenTraitUsingClassHasImproperPrefix($traitUsingClassObject) { - $this->expectException('\ExOrg\DataCoder\CoderClassNotFoundException'); + $this->expectException(self::CODER_CLASS_NOT_FOUND_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $traitUsingClassObject->runBuildCoder(); } @@ -96,7 +99,7 @@ public function testBuildCoderWhenTraitUsingClassHasImproperPrefix($traitUsingCl */ public function testBuildCoderWhenTraitUsingClassHasImproperDataFormat($traitUsingClassObject) { - $this->expectException('\ExOrg\DataCoder\CoderClassNotFoundException'); + $this->expectException(self::CODER_CLASS_NOT_FOUND_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $traitUsingClassObject->runBuildCoder(); } diff --git a/tests/unit_tests/coder_builder/CoderClassNotFoundExceptionTest.php b/tests/unit_tests/CoderBuilder/CoderClassNotFoundExceptionTest.php similarity index 100% rename from tests/unit_tests/coder_builder/CoderClassNotFoundExceptionTest.php rename to tests/unit_tests/CoderBuilder/CoderClassNotFoundExceptionTest.php From 6cc4a1ce8fdb4cf2f783b663dbdaca0c68cad6af Mon Sep 17 00:00:00 2001 From: katheroine Date: Wed, 8 Nov 2023 11:32:24 +0100 Subject: [PATCH 04/26] DatafileDecoder class fixed after changes of File class and CoderBuildingTrait trait (ExOrg#107) --- composer.json | 3 ++- .../datafile_decoders/DatafileDecoder.php | 5 +++++ .../CoderBuilder/CoderClassNotFoundExceptionTest.php | 4 +++- .../datafile_decoders/DatafileDecoderTest.php | 9 ++++++--- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 2023b91..77d30e0 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,8 @@ "tests/unit_tests/coders/datafile_coders/", "tests/unit_tests/coders/datafile_coders/datafile_encoders/", "tests/unit_tests/coders/datafile_coders/datafile_decoders/", - "tests/unit_tests/data_format/" + "tests/unit_tests/data_format/", + "tests/testing_environment/helpers/" ], "ExOrg\\DataCoder\\CoderBuilder\\": [ "tests/testing_environment/classes" diff --git a/src/coders/datafile_coders/datafile_decoders/DatafileDecoder.php b/src/coders/datafile_coders/datafile_decoders/DatafileDecoder.php index 3853a22..0064bb8 100644 --- a/src/coders/datafile_coders/datafile_decoders/DatafileDecoder.php +++ b/src/coders/datafile_coders/datafile_decoders/DatafileDecoder.php @@ -11,6 +11,11 @@ namespace ExOrg\DataCoder; +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; +use ExOrg\DataCoder\CoderBuilder\CoderClassNotFoundException; +use ExOrg\DataCoder\File\File; +use ExOrg\DataCoder\File\FileException; + /** * DatafileDecoder. * Allows to decode data file diff --git a/tests/unit_tests/CoderBuilder/CoderClassNotFoundExceptionTest.php b/tests/unit_tests/CoderBuilder/CoderClassNotFoundExceptionTest.php index f63346c..742d192 100644 --- a/tests/unit_tests/CoderBuilder/CoderClassNotFoundExceptionTest.php +++ b/tests/unit_tests/CoderBuilder/CoderClassNotFoundExceptionTest.php @@ -25,6 +25,8 @@ */ class CoderClassNotFoundExceptionTest extends TestCase { + const CODER_CLASS_NOT_FOUND_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\CoderBuilder\CoderClassNotFoundException'; + /** * Test if ExOrg\DataCoder\CoderClassNotFoundException class * has been created. @@ -32,7 +34,7 @@ class CoderClassNotFoundExceptionTest extends TestCase public function testCoderClassNotFoundExceptionClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\CoderClassNotFoundException') + class_exists(self::CODER_CLASS_NOT_FOUND_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME) ); } } diff --git a/tests/unit_tests/coders/datafile_coders/datafile_decoders/DatafileDecoderTest.php b/tests/unit_tests/coders/datafile_coders/datafile_decoders/DatafileDecoderTest.php index eac1f41..da0d687 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_decoders/DatafileDecoderTest.php +++ b/tests/unit_tests/coders/datafile_coders/datafile_decoders/DatafileDecoderTest.php @@ -26,6 +26,9 @@ */ class DatafileDecoderTest extends TestCase { + const FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\File\FileException'; + const CODER_CLASS_NOT_FOUND_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\CoderBuilder\CoderClassNotFoundException'; + /** * Helper for handling data file fixtures. * @@ -140,7 +143,7 @@ public function testDecodeFileFunctionExists() */ public function testDecodeFileWhenFileDoesNotExist() { - $this->expectException('\ExOrg\DataCoder\FileException'); + $this->expectException(self::FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $dataFilePath = self::$dataFileFixturesHelper->buildEncodedFilePath('noexistent.format'); @@ -153,7 +156,7 @@ public function testDecodeFileWhenFileDoesNotExist() */ public function testDecodeFileWhenImproperDataFormatIsSet() { - $this->expectException('\ExOrg\DataCoder\CoderClassNotFoundException'); + $this->expectException(self::CODER_CLASS_NOT_FOUND_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $dataFilePath = self::$dataFileFixturesHelper->buildEncodedFilePath('data.format'); @@ -185,7 +188,7 @@ public function testDecodeFileWhenDataFormatIsSet() */ public function testDecodeFileWhenDataFormatIsNotSetAndFileHasImproperExtension() { - $this->expectException('\ExOrg\DataCoder\CoderClassNotFoundException'); + $this->expectException(self::CODER_CLASS_NOT_FOUND_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $dataFilePath = self::$dataFileFixturesHelper->buildEncodedFilePath('data.nonexistentformat'); From 9d1e68610f506484c213aa554df2b6efe772029b Mon Sep 17 00:00:00 2001 From: katheroine Date: Wed, 8 Nov 2023 11:43:41 +0100 Subject: [PATCH 05/26] JsonDatafileDecoder class fixed after changes of File class and CoderBuildingTrait trait (ExOrg#107) --- .../datafile_coders/datafile_decoders/JsonDatafileDecoder.php | 2 ++ .../datafile_decoders/JsonDatafileDecoderTest.php | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/coders/datafile_coders/datafile_decoders/JsonDatafileDecoder.php b/src/coders/datafile_coders/datafile_decoders/JsonDatafileDecoder.php index d2fa247..98d474d 100644 --- a/src/coders/datafile_coders/datafile_decoders/JsonDatafileDecoder.php +++ b/src/coders/datafile_coders/datafile_decoders/JsonDatafileDecoder.php @@ -11,6 +11,8 @@ namespace ExOrg\DataCoder; +use ExOrg\DataCoder\File\File; + /** * JsonDatafileDecoder. * Datafile decoder for JSON format. diff --git a/tests/unit_tests/coders/datafile_coders/datafile_decoders/JsonDatafileDecoderTest.php b/tests/unit_tests/coders/datafile_coders/datafile_decoders/JsonDatafileDecoderTest.php index 8d530ef..b12590d 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_decoders/JsonDatafileDecoderTest.php +++ b/tests/unit_tests/coders/datafile_coders/datafile_decoders/JsonDatafileDecoderTest.php @@ -26,6 +26,8 @@ */ class JsonDatafileDecoderTest extends TestCase { + const FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\File\FileException'; + /** * Decoded data format. */ @@ -76,7 +78,7 @@ public function testDecodeFileFunctionExists() */ public function testDecodeFileWhenFileDoesNotExist() { - $this->expectException('\ExOrg\DataCoder\FileException'); + $this->expectException(self::FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $dataFilePath = self::$dataFileFixturesHelper->buildEncodedFilePath('noexistent.format'); From ef3d7fdb00229ac493552ecc4eb3579da6a415bf Mon Sep 17 00:00:00 2001 From: katheroine Date: Wed, 8 Nov 2023 11:50:59 +0100 Subject: [PATCH 06/26] YamlDatafileDecoder class fixed after changes of File class and CoderBuildingTrait trait (ExOrg#107) --- .../datafile_coders/datafile_decoders/YamlDatafileDecoder.php | 2 ++ .../datafile_decoders/YamlDatafileDecoderTest.php | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/coders/datafile_coders/datafile_decoders/YamlDatafileDecoder.php b/src/coders/datafile_coders/datafile_decoders/YamlDatafileDecoder.php index 2210863..405216b 100644 --- a/src/coders/datafile_coders/datafile_decoders/YamlDatafileDecoder.php +++ b/src/coders/datafile_coders/datafile_decoders/YamlDatafileDecoder.php @@ -11,6 +11,8 @@ namespace ExOrg\DataCoder; +use ExOrg\DataCoder\File\File; + /** * YamlDatafileDecoder. * Datafile decoder for YAML format. diff --git a/tests/unit_tests/coders/datafile_coders/datafile_decoders/YamlDatafileDecoderTest.php b/tests/unit_tests/coders/datafile_coders/datafile_decoders/YamlDatafileDecoderTest.php index 2c45b84..9c4e942 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_decoders/YamlDatafileDecoderTest.php +++ b/tests/unit_tests/coders/datafile_coders/datafile_decoders/YamlDatafileDecoderTest.php @@ -26,6 +26,8 @@ */ class YamlDatafileDecoderTest extends TestCase { + const FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\File\FileException'; + /** * Decoded data format. */ @@ -76,7 +78,7 @@ public function testDecodeFileFunctionExists() */ public function testDecodeFileWhenFileDoesNotExist() { - $this->expectException('\ExOrg\DataCoder\FileException'); + $this->expectException(self::FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $dataFilePath = self::$dataFileFixturesHelper->buildEncodedFilePath('noexistent.format'); From b0c39a7f9dd07d3078b2de0009b4a16259ed299f Mon Sep 17 00:00:00 2001 From: katheroine Date: Wed, 8 Nov 2023 19:05:31 +0100 Subject: [PATCH 07/26] DatafileEncoder class fixed after changes of File class and CoderBuildingTrait trait (ExOrg#107) --- .../datafile_coders/datafile_decoders/DatafileDecoder.php | 2 -- .../datafile_coders/datafile_encoders/DatafileEncoder.php | 3 +++ tests/testing_environment/classes/FormatDataEncoder.php | 5 ++++- .../datafile_encoders/DatafileEncoderTest.php | 7 +++++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/coders/datafile_coders/datafile_decoders/DatafileDecoder.php b/src/coders/datafile_coders/datafile_decoders/DatafileDecoder.php index 0064bb8..eb87b06 100644 --- a/src/coders/datafile_coders/datafile_decoders/DatafileDecoder.php +++ b/src/coders/datafile_coders/datafile_decoders/DatafileDecoder.php @@ -12,9 +12,7 @@ namespace ExOrg\DataCoder; use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; -use ExOrg\DataCoder\CoderBuilder\CoderClassNotFoundException; use ExOrg\DataCoder\File\File; -use ExOrg\DataCoder\File\FileException; /** * DatafileDecoder. diff --git a/src/coders/datafile_coders/datafile_encoders/DatafileEncoder.php b/src/coders/datafile_coders/datafile_encoders/DatafileEncoder.php index bc70f46..7a5a024 100644 --- a/src/coders/datafile_coders/datafile_encoders/DatafileEncoder.php +++ b/src/coders/datafile_coders/datafile_encoders/DatafileEncoder.php @@ -11,6 +11,9 @@ namespace ExOrg\DataCoder; +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; +use ExOrg\DataCoder\File\File; + /** * DatafileEncoder. * Allows to encode data file diff --git a/tests/testing_environment/classes/FormatDataEncoder.php b/tests/testing_environment/classes/FormatDataEncoder.php index 38d41ab..e6f8526 100644 --- a/tests/testing_environment/classes/FormatDataEncoder.php +++ b/tests/testing_environment/classes/FormatDataEncoder.php @@ -32,8 +32,11 @@ class FormatDataEncoder */ public function encodeData($data) { + $dataValues = array_values($data); + $dataCore = array_shift($dataValues); + return "" - . array_shift(array_values($data)) + . $dataCore . ""; } } diff --git a/tests/unit_tests/coders/datafile_coders/datafile_encoders/DatafileEncoderTest.php b/tests/unit_tests/coders/datafile_coders/datafile_encoders/DatafileEncoderTest.php index 425c3c0..0579ddb 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_encoders/DatafileEncoderTest.php +++ b/tests/unit_tests/coders/datafile_coders/datafile_encoders/DatafileEncoderTest.php @@ -26,6 +26,8 @@ */ class DatafileEncoderTest extends TestCase { + const CODER_CLASS_NOT_FOUND_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\CoderBuilder\CoderClassNotFoundException'; + /** * Helper for handling data file fixtures. * @@ -142,7 +144,7 @@ public function testEncodeFileFunctionExists() */ public function testEncodeFileWhenImproperDataFormatIsSet() { - $this->expectException('\ExOrg\DataCoder\CoderClassNotFoundException'); + $this->expectException(self::CODER_CLASS_NOT_FOUND_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $dataFilePath = self::$dataFileFixturesHelper->buildCreatedFilePath('data.format'); @@ -166,6 +168,7 @@ public function testEncodeFileWhenDataFormatIsSet() $actualResult = file_get_contents($dataFilePath); $this->assertEquals($expectedResult, $actualResult); + $this->assertTrue(true); } /** @@ -176,7 +179,7 @@ public function testEncodeFileWhenDataFormatIsSet() */ public function testEncodeFileWhenDataFormatIsNotSetAndFileHasImproperExtension() { - $this->expectException('\ExOrg\DataCoder\CoderClassNotFoundException'); + $this->expectException(self::CODER_CLASS_NOT_FOUND_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $dataFilePath = self::$dataFileFixturesHelper->buildCreatedFilePath('data.nonexistentformat'); From 7da85a0570ccd458227cd463f6194780f86f2df4 Mon Sep 17 00:00:00 2001 From: katheroine Date: Wed, 8 Nov 2023 21:27:39 +0100 Subject: [PATCH 08/26] JsonDatafileEncoder class fixed after changes of File class and CoderBuildingTrait trait (ExOrg#107) --- .../datafile_coders/datafile_encoders/JsonDatafileEncoder.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/coders/datafile_coders/datafile_encoders/JsonDatafileEncoder.php b/src/coders/datafile_coders/datafile_encoders/JsonDatafileEncoder.php index b355778..fe0102c 100644 --- a/src/coders/datafile_coders/datafile_encoders/JsonDatafileEncoder.php +++ b/src/coders/datafile_coders/datafile_encoders/JsonDatafileEncoder.php @@ -11,6 +11,8 @@ namespace ExOrg\DataCoder; +use ExOrg\DataCoder\File\File; + /** * JsonDatafileEncoder. * Datafile encoder for JSON format. From 083d23e4dbec8d2c5bffb5d8fa163fc723d35373 Mon Sep 17 00:00:00 2001 From: katheroine Date: Wed, 8 Nov 2023 21:29:03 +0100 Subject: [PATCH 09/26] YamlDatafileEncoder class fixed after changes of File class and CoderBuildingTrait trait (ExOrg#107) --- .../datafile_coders/datafile_encoders/YamlDatafileEncoder.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/coders/datafile_coders/datafile_encoders/YamlDatafileEncoder.php b/src/coders/datafile_coders/datafile_encoders/YamlDatafileEncoder.php index 8574b42..df93782 100644 --- a/src/coders/datafile_coders/datafile_encoders/YamlDatafileEncoder.php +++ b/src/coders/datafile_coders/datafile_encoders/YamlDatafileEncoder.php @@ -11,6 +11,8 @@ namespace ExOrg\DataCoder; +use ExOrg\DataCoder\File\File; + /** * YamlDatafileEncoder. * Datafile encoder for YAML format. From 3d8b5ffc22a1dfb69edbf4e3edc2c8763b5c8f30 Mon Sep 17 00:00:00 2001 From: katheroine Date: Thu, 9 Nov 2023 09:56:51 +0100 Subject: [PATCH 10/26] DataDecoder class fixed after changes of File class and CoderBuildingTrait trait (ExOrg#107) --- src/coders/data_coders/data_decoders/DataDecoder.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/coders/data_coders/data_decoders/DataDecoder.php b/src/coders/data_coders/data_decoders/DataDecoder.php index b440a82..7072223 100644 --- a/src/coders/data_coders/data_decoders/DataDecoder.php +++ b/src/coders/data_coders/data_decoders/DataDecoder.php @@ -11,6 +11,8 @@ namespace ExOrg\DataCoder; +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; + /** * DataDecoder. * Allows to decode data From f7782fb734c3f0a6abbcce908d4ad380f7825bce Mon Sep 17 00:00:00 2001 From: katheroine Date: Thu, 9 Nov 2023 10:04:54 +0100 Subject: [PATCH 11/26] DataEncoder class fixed after changes of File class and CoderBuildingTrait trait (ExOrg#107) --- src/coders/data_coders/data_encoders/DataEncoder.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/coders/data_coders/data_encoders/DataEncoder.php b/src/coders/data_coders/data_encoders/DataEncoder.php index 344fc06..483b120 100644 --- a/src/coders/data_coders/data_encoders/DataEncoder.php +++ b/src/coders/data_coders/data_encoders/DataEncoder.php @@ -11,6 +11,8 @@ namespace ExOrg\DataCoder; +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; + /** * DataEncoder. * Allows to encode data From 20d4636b7e09ab9ea983a8e5eb0bd53baf71d086 Mon Sep 17 00:00:00 2001 From: katheroine Date: Thu, 9 Nov 2023 14:41:45 +0100 Subject: [PATCH 12/26] Data Encoders classes namespaces changed, class file paths updated (ExOrg#107) --- composer.json | 3 ++- .../Data/AbstractEncoder.php} | 4 ++-- .../Data/Encoder.php} | 6 ++++-- .../Data/EncodingStrategyInterface.php} | 6 +++--- .../Json/Data/Encoder.php} | 9 ++++++--- .../Yaml/Data/Encoder.php} | 8 +++++--- src/CoderBuilder/CoderBuildingTrait.php | 10 +++++++++- .../DataFormat.php | 2 +- .../DataFormatConfigurableTrait.php | 2 +- .../DataFormatInvalidException.php | 2 +- .../Format/Data/Decoder.php} | 4 ++-- .../Format/Data/Encoder.php} | 4 ++-- .../Format1/Data/Decoder.php} | 4 ++-- .../Format1/Data/Encoder.php} | 4 ++-- .../Format2/Data/Decoder.php} | 4 ++-- .../Format2/Data/Encoder.php} | 4 ++-- .../Format3/Data/Decoder.php} | 4 ++-- .../Format3/Data/Encoder.php} | 4 ++-- .../Data/EncoderTest.php} | 19 ++++++++++++------- .../Json/Data/EncoderTest.php} | 16 ++++++++++------ .../Yaml/Data/EncoderTest.php} | 15 +++++++++------ .../DataFormatInvalidExceptionTest.php | 4 ++-- .../DataFormatTest.php | 8 +++++--- 23 files changed, 88 insertions(+), 58 deletions(-) rename src/{coders/data_coders/data_encoders/AbstractDataEncoder.php => Coder/Data/AbstractEncoder.php} (92%) rename src/{coders/data_coders/data_encoders/DataEncoder.php => Coder/Data/Encoder.php} (82%) rename src/{coders/data_coders/data_encoders/DataEncodingStrategyInterface.php => Coder/Data/EncodingStrategyInterface.php} (86%) rename src/{coders/data_coders/data_encoders/JsonDataEncoder.php => Coder/Json/Data/Encoder.php} (78%) rename src/{coders/data_coders/data_encoders/YamlDataEncoder.php => Coder/Yaml/Data/Encoder.php} (78%) rename src/{data_format => DataFormat}/DataFormat.php (94%) rename src/{data_format => DataFormat}/DataFormatConfigurableTrait.php (97%) rename src/{data_format => DataFormat}/DataFormatInvalidException.php (94%) rename tests/testing_environment/classes/{FormatDataDecoder.php => Coder/Format/Data/Decoder.php} (93%) rename tests/testing_environment/classes/{FormatDataEncoder.php => Coder/Format/Data/Encoder.php} (93%) rename tests/testing_environment/classes/{Format1DataDecoder.php => Coder/Format1/Data/Decoder.php} (92%) rename tests/testing_environment/classes/{Format1DataEncoder.php => Coder/Format1/Data/Encoder.php} (92%) rename tests/testing_environment/classes/{Format2DataDecoder.php => Coder/Format2/Data/Decoder.php} (92%) rename tests/testing_environment/classes/{Format2DataEncoder.php => Coder/Format2/Data/Encoder.php} (92%) rename tests/testing_environment/classes/{Format3DataDecoder.php => Coder/Format3/Data/Decoder.php} (92%) rename tests/testing_environment/classes/{Format3DataEncoder.php => Coder/Format3/Data/Encoder.php} (92%) rename tests/unit_tests/{coders/data_coders/data_encoders/DataEncoderTest.php => Coder/Data/EncoderTest.php} (89%) rename tests/unit_tests/{coders/data_coders/data_encoders/JsonDataEncoderTest.php => Coder/Json/Data/EncoderTest.php} (85%) rename tests/unit_tests/{coders/data_coders/data_encoders/YamlDataEncoderTest.php => Coder/Yaml/Data/EncoderTest.php} (86%) rename tests/unit_tests/{data_format => DataFormat}/DataFormatInvalidExceptionTest.php (88%) rename tests/unit_tests/{data_format => DataFormat}/DataFormatTest.php (83%) diff --git a/composer.json b/composer.json index 77d30e0..75f4d33 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,8 @@ "tests/unit_tests/coders/datafile_coders/datafile_encoders/", "tests/unit_tests/coders/datafile_coders/datafile_decoders/", "tests/unit_tests/data_format/", - "tests/testing_environment/helpers/" + "tests/testing_environment/helpers/", + "tests/testing_environment/classes/" ], "ExOrg\\DataCoder\\CoderBuilder\\": [ "tests/testing_environment/classes" diff --git a/src/coders/data_coders/data_encoders/AbstractDataEncoder.php b/src/Coder/Data/AbstractEncoder.php similarity index 92% rename from src/coders/data_coders/data_encoders/AbstractDataEncoder.php rename to src/Coder/Data/AbstractEncoder.php index ac7884a..c48b233 100644 --- a/src/coders/data_coders/data_encoders/AbstractDataEncoder.php +++ b/src/Coder/Data/AbstractEncoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Data; /** * AbstractDataEncoder. @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -abstract class AbstractDataEncoder +abstract class AbstractEncoder { /** * Validate data. diff --git a/src/coders/data_coders/data_encoders/DataEncoder.php b/src/Coder/Data/Encoder.php similarity index 82% rename from src/coders/data_coders/data_encoders/DataEncoder.php rename to src/Coder/Data/Encoder.php index 483b120..22da0e1 100644 --- a/src/coders/data_coders/data_encoders/DataEncoder.php +++ b/src/Coder/Data/Encoder.php @@ -9,9 +9,11 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Data; +use ExOrg\DataCoder\Coder\Data\EncodingStrategyInterface; use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; +use ExOrg\DataCoder\DataFormat\DataFormatConfigurableTrait; /** * DataEncoder. @@ -24,7 +26,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class DataEncoder +class Encoder implements EncodingStrategyInterface { use DataFormatConfigurableTrait; use CoderBuildingTrait; diff --git a/src/coders/data_coders/data_encoders/DataEncodingStrategyInterface.php b/src/Coder/Data/EncodingStrategyInterface.php similarity index 86% rename from src/coders/data_coders/data_encoders/DataEncodingStrategyInterface.php rename to src/Coder/Data/EncodingStrategyInterface.php index de5a218..29c4377 100644 --- a/src/coders/data_coders/data_encoders/DataEncodingStrategyInterface.php +++ b/src/Coder/Data/EncodingStrategyInterface.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Data; /** - * DataEncodingStrategyInterface. + * Data Encoding Strategy Interface. * Defines interface of particular data encoding strategy. * * @package DataCoder @@ -21,7 +21,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -interface DataEncodingStrategyInterface +interface EncodingStrategyInterface { /** * Encode data. diff --git a/src/coders/data_coders/data_encoders/JsonDataEncoder.php b/src/Coder/Json/Data/Encoder.php similarity index 78% rename from src/coders/data_coders/data_encoders/JsonDataEncoder.php rename to src/Coder/Json/Data/Encoder.php index 9bb730c..7973735 100644 --- a/src/coders/data_coders/data_encoders/JsonDataEncoder.php +++ b/src/Coder/Json/Data/Encoder.php @@ -9,10 +9,13 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Json\Data; + +use ExOrg\DataCoder\Coder\Data\AbstractEncoder; +use ExOrg\DataCoder\Coder\Data\EncodingStrategyInterface; /** - * JsonDataEncoder. + * Json Data Encoder. * Data encoder for JSON format. * * @package DataCoder @@ -21,7 +24,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class JsonDataEncoder extends AbstractDataEncoder implements DataEncodingStrategyInterface +class Encoder extends AbstractEncoder implements EncodingStrategyInterface { /** * Encode given PHP array to JSON data. diff --git a/src/coders/data_coders/data_encoders/YamlDataEncoder.php b/src/Coder/Yaml/Data/Encoder.php similarity index 78% rename from src/coders/data_coders/data_encoders/YamlDataEncoder.php rename to src/Coder/Yaml/Data/Encoder.php index 3da42b1..28b427a 100644 --- a/src/coders/data_coders/data_encoders/YamlDataEncoder.php +++ b/src/Coder/Yaml/Data/Encoder.php @@ -9,12 +9,14 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Yaml\Data; +use ExOrg\DataCoder\Coder\Data\AbstractEncoder; +use ExOrg\DataCoder\Coder\Data\EncodingStrategyInterface; use Symfony\Component\Yaml\Yaml; /** - * YamlDataEncoder. + * Yaml Data Encoder. * Data encoder for YAML format. * * @package DataCoder @@ -23,7 +25,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class YamlDataEncoder extends AbstractDataEncoder implements DataEncodingStrategyInterface +class Encoder extends AbstractEncoder implements EncodingStrategyInterface { /** * Encode given PHP array to YAML data. diff --git a/src/CoderBuilder/CoderBuildingTrait.php b/src/CoderBuilder/CoderBuildingTrait.php index 83419da..bf45629 100644 --- a/src/CoderBuilder/CoderBuildingTrait.php +++ b/src/CoderBuilder/CoderBuildingTrait.php @@ -76,10 +76,18 @@ private function buildCoderClassName() $dataFormatPrefix = $this->establishDataFormatPrefix(); $coderTypePostfix = $this->extractCurrentClassNamePostfix(); - $coderClassName = __NAMESPACE__ + // $coderClassName = __NAMESPACE__ + // . '\\' + // . $dataFormatPrefix + // . 'Data' + // . $coderTypePostfix; + + $coderClassName = 'ExOrg\\DataCoder\Coder' . '\\' . $dataFormatPrefix + . '\\' . 'Data' + . '\\' . $coderTypePostfix; return $coderClassName; diff --git a/src/data_format/DataFormat.php b/src/DataFormat/DataFormat.php similarity index 94% rename from src/data_format/DataFormat.php rename to src/DataFormat/DataFormat.php index 78f46df..2b8dac5 100644 --- a/src/data_format/DataFormat.php +++ b/src/DataFormat/DataFormat.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\DataFormat; use Garoevans\PhpEnum\Enum; diff --git a/src/data_format/DataFormatConfigurableTrait.php b/src/DataFormat/DataFormatConfigurableTrait.php similarity index 97% rename from src/data_format/DataFormatConfigurableTrait.php rename to src/DataFormat/DataFormatConfigurableTrait.php index dada6e2..b89551c 100644 --- a/src/data_format/DataFormatConfigurableTrait.php +++ b/src/DataFormat/DataFormatConfigurableTrait.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\DataFormat; /** * DataFormatConfigurableTrait. diff --git a/src/data_format/DataFormatInvalidException.php b/src/DataFormat/DataFormatInvalidException.php similarity index 94% rename from src/data_format/DataFormatInvalidException.php rename to src/DataFormat/DataFormatInvalidException.php index d4714c3..7edb489 100644 --- a/src/data_format/DataFormatInvalidException.php +++ b/src/DataFormat/DataFormatInvalidException.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\DataFormat; /** * DataFormatInvalidException. diff --git a/tests/testing_environment/classes/FormatDataDecoder.php b/tests/testing_environment/classes/Coder/Format/Data/Decoder.php similarity index 93% rename from tests/testing_environment/classes/FormatDataDecoder.php rename to tests/testing_environment/classes/Coder/Format/Data/Decoder.php index bc74b71..8f5f44f 100644 --- a/tests/testing_environment/classes/FormatDataDecoder.php +++ b/tests/testing_environment/classes/Coder/Format/Data/Decoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\Coder\Format\Data; /** * FormatDataDecoder. @@ -21,7 +21,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class FormatDataDecoder +class Decoder { /** * Simulate data decodind diff --git a/tests/testing_environment/classes/FormatDataEncoder.php b/tests/testing_environment/classes/Coder/Format/Data/Encoder.php similarity index 93% rename from tests/testing_environment/classes/FormatDataEncoder.php rename to tests/testing_environment/classes/Coder/Format/Data/Encoder.php index e6f8526..6bb3ce1 100644 --- a/tests/testing_environment/classes/FormatDataEncoder.php +++ b/tests/testing_environment/classes/Coder/Format/Data/Encoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\Coder\Format\Data; /** * FormatDataEncoder. @@ -21,7 +21,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class FormatDataEncoder +class Encoder { /** * Simulate data encoding diff --git a/tests/testing_environment/classes/Format1DataDecoder.php b/tests/testing_environment/classes/Coder/Format1/Data/Decoder.php similarity index 92% rename from tests/testing_environment/classes/Format1DataDecoder.php rename to tests/testing_environment/classes/Coder/Format1/Data/Decoder.php index e64107e..a1092c5 100644 --- a/tests/testing_environment/classes/Format1DataDecoder.php +++ b/tests/testing_environment/classes/Coder/Format1/Data/Decoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\Coder\Format1\Data; /** * Dummy data decoder for testing purposes only. @@ -20,7 +20,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class Format1DataDecoder +class Decoder { /** * Simulates data decodind diff --git a/tests/testing_environment/classes/Format1DataEncoder.php b/tests/testing_environment/classes/Coder/Format1/Data/Encoder.php similarity index 92% rename from tests/testing_environment/classes/Format1DataEncoder.php rename to tests/testing_environment/classes/Coder/Format1/Data/Encoder.php index 2733d35..a9bd0b6 100644 --- a/tests/testing_environment/classes/Format1DataEncoder.php +++ b/tests/testing_environment/classes/Coder/Format1/Data/Encoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\Coder\Format1\Data; /** * Dummy data encoder for testing purposes only. @@ -20,7 +20,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class Format1DataEncoder +class Encoder { /** * Simulates data encoding diff --git a/tests/testing_environment/classes/Format2DataDecoder.php b/tests/testing_environment/classes/Coder/Format2/Data/Decoder.php similarity index 92% rename from tests/testing_environment/classes/Format2DataDecoder.php rename to tests/testing_environment/classes/Coder/Format2/Data/Decoder.php index 7f9454f..05c9833 100644 --- a/tests/testing_environment/classes/Format2DataDecoder.php +++ b/tests/testing_environment/classes/Coder/Format2/Data/Decoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\Coder\Format2\Data; /** * Dummy data decoder for testing purposes only. @@ -20,7 +20,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class Format2DataDecoder +class Decoder { /** * Simulate data decodind diff --git a/tests/testing_environment/classes/Format2DataEncoder.php b/tests/testing_environment/classes/Coder/Format2/Data/Encoder.php similarity index 92% rename from tests/testing_environment/classes/Format2DataEncoder.php rename to tests/testing_environment/classes/Coder/Format2/Data/Encoder.php index 7d03842..9fb4f5c 100644 --- a/tests/testing_environment/classes/Format2DataEncoder.php +++ b/tests/testing_environment/classes/Coder/Format2/Data/Encoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\Coder\Format2\Data; /** * Dummy data encoder for testing purposes only. @@ -20,7 +20,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class Format2DataEncoder +class Encoder { /** * Simulates data encoding diff --git a/tests/testing_environment/classes/Format3DataDecoder.php b/tests/testing_environment/classes/Coder/Format3/Data/Decoder.php similarity index 92% rename from tests/testing_environment/classes/Format3DataDecoder.php rename to tests/testing_environment/classes/Coder/Format3/Data/Decoder.php index 436d55f..9a60c64 100644 --- a/tests/testing_environment/classes/Format3DataDecoder.php +++ b/tests/testing_environment/classes/Coder/Format3/Data/Decoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\Coder\Format3\Data; /** * Dummy data decoder for testing purposes only. @@ -20,7 +20,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class Format3DataDecoder +class Decoder { /** * Simulate data decodind diff --git a/tests/testing_environment/classes/Format3DataEncoder.php b/tests/testing_environment/classes/Coder/Format3/Data/Encoder.php similarity index 92% rename from tests/testing_environment/classes/Format3DataEncoder.php rename to tests/testing_environment/classes/Coder/Format3/Data/Encoder.php index 1ac905f..ee1bb9a 100644 --- a/tests/testing_environment/classes/Format3DataEncoder.php +++ b/tests/testing_environment/classes/Coder/Format3/Data/Encoder.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\Coder\Format3\Data; /** * Dummy data encoder for testing purposes only. @@ -20,7 +20,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class Format3DataEncoder +class Encoder { /** * Simulates data encoding diff --git a/tests/unit_tests/coders/data_coders/data_encoders/DataEncoderTest.php b/tests/unit_tests/Coder/Data/EncoderTest.php similarity index 89% rename from tests/unit_tests/coders/data_coders/data_encoders/DataEncoderTest.php rename to tests/unit_tests/Coder/Data/EncoderTest.php index 0877b21..3c9b66d 100644 --- a/tests/unit_tests/coders/data_coders/data_encoders/DataEncoderTest.php +++ b/tests/unit_tests/Coder/Data/EncoderTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Data; use ExOrg\Decapsulator\ObjectDecapsulator; use PHPUnit\Framework\TestCase; @@ -24,8 +24,10 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class DataEncoderTest extends TestCase +class EncoderTest extends TestCase { + const ENCODER_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\Coder\Data\Encoder'; + /** * Instance of tested class. * @@ -40,7 +42,7 @@ class DataEncoderTest extends TestCase public function testDataEncoderClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\DataEncoder') + class_exists(self::ENCODER_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -52,7 +54,7 @@ public function testSetDataFormatFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\DataEncoder', + self::ENCODER_FULLY_QUALIFIED_CLASS_NAME, 'setDataFormat' ) ); @@ -120,7 +122,7 @@ public function testEncodeDataFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\DataEncoder', + self::ENCODER_FULLY_QUALIFIED_CLASS_NAME, 'encodeData' ) ); @@ -137,8 +139,11 @@ public function testEncodeData($data) { $this->dataEncoder->setDataFormat('format'); + $dataValues = array_values($data); + $dataCore = array_shift($dataValues); + $expectedResult = "" - . array_shift(array_values($data)) + . $dataCore . ""; $actualResult = $this->dataEncoder->encodeData($data, 'file'); @@ -181,6 +186,6 @@ public static function dataProvider() */ protected function setUp(): void { - $this->dataEncoder = new DataEncoder(); + $this->dataEncoder = new Encoder(); } } diff --git a/tests/unit_tests/coders/data_coders/data_encoders/JsonDataEncoderTest.php b/tests/unit_tests/Coder/Json/Data/EncoderTest.php similarity index 85% rename from tests/unit_tests/coders/data_coders/data_encoders/JsonDataEncoderTest.php rename to tests/unit_tests/Coder/Json/Data/EncoderTest.php index 70fc84a..9d0a336 100644 --- a/tests/unit_tests/coders/data_coders/data_encoders/JsonDataEncoderTest.php +++ b/tests/unit_tests/Coder/Json/Data/EncoderTest.php @@ -9,12 +9,14 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Json\Data; use PHPUnit\Framework\TestCase; +use ExOrg\DataCoder\ObjectDecapsulator; +use ExOrg\DataCoder\DataFileFixturesHelper; /** - * JsonDataEncoderTest. + * Json Data Encoder Test. * PHPUnit test class for JsonDataEncoder class. * * @package DataCoder @@ -23,8 +25,10 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class JsonDataEncoderTest extends TestCase +class EncoderTest extends TestCase { + const ENCODER_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\Coder\Json\Data\Encoder'; + /** * Encoded data format. */ @@ -51,7 +55,7 @@ class JsonDataEncoderTest extends TestCase public function testJsonDataEncoderClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\JsonDataEncoder') + class_exists(self::ENCODER_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -63,7 +67,7 @@ public function testEncodeDataFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\JsonDataEncoder', + self::ENCODER_FULLY_QUALIFIED_CLASS_NAME, 'encodeData' ) ); @@ -111,6 +115,6 @@ public static function setUpBeforeClass(): void */ protected function setUp(): void { - $this->jsonDataEncoder = new JsonDataEncoder(); + $this->jsonDataEncoder = new Encoder(); } } diff --git a/tests/unit_tests/coders/data_coders/data_encoders/YamlDataEncoderTest.php b/tests/unit_tests/Coder/Yaml/Data/EncoderTest.php similarity index 86% rename from tests/unit_tests/coders/data_coders/data_encoders/YamlDataEncoderTest.php rename to tests/unit_tests/Coder/Yaml/Data/EncoderTest.php index 9a81e63..1288683 100644 --- a/tests/unit_tests/coders/data_coders/data_encoders/YamlDataEncoderTest.php +++ b/tests/unit_tests/Coder/Yaml/Data/EncoderTest.php @@ -9,12 +9,13 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Yaml\Data; use PHPUnit\Framework\TestCase; +use ExOrg\DataCoder\DataFileFixturesHelper; /** - * YamlDataEncoderTest. + * Yaml Data Encoder Test. * PHPUnit test class for YamlDataEncoder class. * * @package DataCoder @@ -23,8 +24,10 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class YamlDataEncoderTest extends TestCase +class EncoderTest extends TestCase { + const ENCODER_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\Coder\Yaml\Data\Encoder'; + /** * Encoded data format. */ @@ -51,7 +54,7 @@ class YamlDataEncoderTest extends TestCase public function testYamlDataEncoderClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\YamlDataEncoder') + class_exists(self::ENCODER_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -63,7 +66,7 @@ public function testEncodeDataFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\YamlDataEncoder', + self::ENCODER_FULLY_QUALIFIED_CLASS_NAME, 'encodeData' ) ); @@ -111,6 +114,6 @@ public static function setUpBeforeClass(): void */ protected function setUp(): void { - $this->yamlDataEncoder = new YamlDataEncoder(); + $this->yamlDataEncoder = new Encoder(); } } diff --git a/tests/unit_tests/data_format/DataFormatInvalidExceptionTest.php b/tests/unit_tests/DataFormat/DataFormatInvalidExceptionTest.php similarity index 88% rename from tests/unit_tests/data_format/DataFormatInvalidExceptionTest.php rename to tests/unit_tests/DataFormat/DataFormatInvalidExceptionTest.php index 08fb1bc..54f44a5 100644 --- a/tests/unit_tests/data_format/DataFormatInvalidExceptionTest.php +++ b/tests/unit_tests/DataFormat/DataFormatInvalidExceptionTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\DataFormat; use PHPUnit\Framework\TestCase; @@ -32,7 +32,7 @@ class DataFormatInvalidExceptionTest extends TestCase public function testDataFormatInvalidExceptionClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\DataFormatInvalidException') + class_exists('ExOrg\DataCoder\DataFormat\DataFormatInvalidException') ); } } diff --git a/tests/unit_tests/data_format/DataFormatTest.php b/tests/unit_tests/DataFormat/DataFormatTest.php similarity index 83% rename from tests/unit_tests/data_format/DataFormatTest.php rename to tests/unit_tests/DataFormat/DataFormatTest.php index 84eefad..20c6665 100644 --- a/tests/unit_tests/data_format/DataFormatTest.php +++ b/tests/unit_tests/DataFormat/DataFormatTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\DataFormat; use PHPUnit\Framework\TestCase; @@ -25,6 +25,8 @@ */ class DataFormatTest extends TestCase { + const DATA_FORMAT_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\DataFormat\DataFormat'; + /** * Test ExOrg\DatafilesParser\DataFormat enum * has been implemented. @@ -32,7 +34,7 @@ class DataFormatTest extends TestCase public function testDataFormatExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\DataFormat') + class_exists(self::DATA_FORMAT_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -47,7 +49,7 @@ class_exists('ExOrg\DataCoder\DataFormat') */ public function testDataFormatsItems($formatAbbreviation, $expectedFormatFullName) { - $actualFormatFullName = constant("ExOrg\DataCoder\DataFormat::$formatAbbreviation"); + $actualFormatFullName = constant(self::DATA_FORMAT_FULLY_QUALIFIED_CLASS_NAME . "::" . $formatAbbreviation); $this->assertEquals($expectedFormatFullName, $actualFormatFullName); } From 626d15a7df96791f0af62bba5a5c71f78d8ebda6 Mon Sep 17 00:00:00 2001 From: katheroine Date: Thu, 9 Nov 2023 21:25:39 +0100 Subject: [PATCH 13/26] Data Decoders classes namespaces changed, class file paths updated (ExOrg#107) --- .../Data/AbstractDecoder.php} | 6 +++--- .../DataDecoder.php => Coder/Data/Decoder.php} | 6 ++++-- .../Data/DecodingStrategyInterface.php} | 6 +++--- .../Json/Data/Decoder.php} | 10 +++++++--- .../Yaml/Data/Decoder.php} | 9 ++++++--- .../Data/DecoderTest.php} | 14 ++++++++------ .../Json/Data/DecoderTest.php} | 18 +++++++++++------- .../Yaml/Data/DecoderTest.php} | 18 +++++++++++------- 8 files changed, 53 insertions(+), 34 deletions(-) rename src/{coders/data_coders/data_decoders/AbstractDataDecoder.php => Coder/Data/AbstractDecoder.php} (90%) rename src/{coders/data_coders/data_decoders/DataDecoder.php => Coder/Data/Decoder.php} (82%) rename src/{coders/data_coders/data_decoders/DataDecodingStrategyInterface.php => Coder/Data/DecodingStrategyInterface.php} (86%) rename src/{coders/data_coders/data_decoders/JsonDataDecoder.php => Coder/Json/Data/Decoder.php} (78%) rename src/{coders/data_coders/data_decoders/YamlDataDecoder.php => Coder/Yaml/Data/Decoder.php} (81%) rename tests/unit_tests/{coders/data_coders/data_decoders/DataDecoderTest.php => Coder/Data/DecoderTest.php} (91%) rename tests/unit_tests/{coders/data_coders/data_decoders/JsonDataDecoderTest.php => Coder/Json/Data/DecoderTest.php} (81%) rename tests/unit_tests/{coders/data_coders/data_decoders/YamlDataDecoderTest.php => Coder/Yaml/Data/DecoderTest.php} (81%) diff --git a/src/coders/data_coders/data_decoders/AbstractDataDecoder.php b/src/Coder/Data/AbstractDecoder.php similarity index 90% rename from src/coders/data_coders/data_decoders/AbstractDataDecoder.php rename to src/Coder/Data/AbstractDecoder.php index df084f3..5e15ee7 100644 --- a/src/coders/data_coders/data_decoders/AbstractDataDecoder.php +++ b/src/Coder/Data/AbstractDecoder.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Data; /** - * AbstractDataDecoder. + * Abstract Data Decoder. * Abstract class for Data Decoder * for concrete data format. * @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -abstract class AbstractDataDecoder +abstract class AbstractDecoder { /** * Validate data. diff --git a/src/coders/data_coders/data_decoders/DataDecoder.php b/src/Coder/Data/Decoder.php similarity index 82% rename from src/coders/data_coders/data_decoders/DataDecoder.php rename to src/Coder/Data/Decoder.php index 7072223..c116616 100644 --- a/src/coders/data_coders/data_decoders/DataDecoder.php +++ b/src/Coder/Data/Decoder.php @@ -9,9 +9,11 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Data; +use ExOrg\DataCoder\Coder\Data\DecodingStrategyInterface; use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; +use ExOrg\DataCoder\DataFormat\DataFormatConfigurableTrait; /** * DataDecoder. @@ -24,7 +26,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class DataDecoder +class Decoder implements DecodingStrategyInterface { use DataFormatConfigurableTrait; use CoderBuildingTrait; diff --git a/src/coders/data_coders/data_decoders/DataDecodingStrategyInterface.php b/src/Coder/Data/DecodingStrategyInterface.php similarity index 86% rename from src/coders/data_coders/data_decoders/DataDecodingStrategyInterface.php rename to src/Coder/Data/DecodingStrategyInterface.php index 655a926..ceb8e44 100644 --- a/src/coders/data_coders/data_decoders/DataDecodingStrategyInterface.php +++ b/src/Coder/Data/DecodingStrategyInterface.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Data; /** - * DataDecodingStrategyInterface. + * Data Decoding Strategy Interface. * Defines interface of particular data decoding strategy. * * @package DataCoder @@ -21,7 +21,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -interface DataDecodingStrategyInterface +interface DecodingStrategyInterface { /** * Decode data. diff --git a/src/coders/data_coders/data_decoders/JsonDataDecoder.php b/src/Coder/Json/Data/Decoder.php similarity index 78% rename from src/coders/data_coders/data_decoders/JsonDataDecoder.php rename to src/Coder/Json/Data/Decoder.php index 85d370f..2efd4f8 100644 --- a/src/coders/data_coders/data_decoders/JsonDataDecoder.php +++ b/src/Coder/Json/Data/Decoder.php @@ -9,10 +9,14 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Json\Data; + +use ExOrg\DataCoder\Coder\Data\AbstractDecoder; +use ExOrg\DataCoder\Coder\Data\DecodingStrategyInterface; +use ExOrg\DataCoder\DataFormat\DataFormatInvalidException; /** - * JsonDataDecoder. + * Json Data Decoder. * Data decoder for JSON format. * * @package DataCoder @@ -21,7 +25,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class JsonDataDecoder extends AbstractDataDecoder implements DataDecodingStrategyInterface +class Decoder extends AbstractDecoder implements DecodingStrategyInterface { /** * Decode given JSON data to PHP array. diff --git a/src/coders/data_coders/data_decoders/YamlDataDecoder.php b/src/Coder/Yaml/Data/Decoder.php similarity index 81% rename from src/coders/data_coders/data_decoders/YamlDataDecoder.php rename to src/Coder/Yaml/Data/Decoder.php index bd4bfad..6ef157a 100644 --- a/src/coders/data_coders/data_decoders/YamlDataDecoder.php +++ b/src/Coder/Yaml/Data/Decoder.php @@ -9,12 +9,15 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Yaml\Data; +use ExOrg\DataCoder\Coder\Data\AbstractDecoder; +use ExOrg\DataCoder\Coder\Data\DecodingStrategyInterface; +use ExOrg\DataCoder\DataFormat\DataFormatInvalidException; use Symfony\Component\Yaml\Yaml; /** - * YamlDataDecoder. + * Yaml Data Decoder. * Data decoder for YAML format. * * @package DataCoder @@ -23,7 +26,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class YamlDataDecoder extends AbstractDataDecoder implements DataDecodingStrategyInterface +class Decoder extends AbstractDecoder implements DecodingStrategyInterface { /** * Decode given YAML data to PHP array. diff --git a/tests/unit_tests/coders/data_coders/data_decoders/DataDecoderTest.php b/tests/unit_tests/Coder/Data/DecoderTest.php similarity index 91% rename from tests/unit_tests/coders/data_coders/data_decoders/DataDecoderTest.php rename to tests/unit_tests/Coder/Data/DecoderTest.php index 6af9700..e116159 100644 --- a/tests/unit_tests/coders/data_coders/data_decoders/DataDecoderTest.php +++ b/tests/unit_tests/Coder/Data/DecoderTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Data; use PHPUnit\Framework\TestCase; use ExOrg\Decapsulator\ObjectDecapsulator; @@ -24,8 +24,10 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class DataDecoderTest extends TestCase +class DecoderTest extends TestCase { + const DECODER_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\Coder\Data\Decoder'; + /** * Instance of tested class. * @@ -40,7 +42,7 @@ class DataDecoderTest extends TestCase public function testDataDecoderClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\DataDecoder') + class_exists(self::DECODER_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -52,7 +54,7 @@ public function testSetDataFormatFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\DataDecoder', + self::DECODER_FULLY_QUALIFIED_CLASS_NAME, 'setDataFormat' ) ); @@ -120,7 +122,7 @@ public function testDecodeDataFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\DataDecoder', + self::DECODER_FULLY_QUALIFIED_CLASS_NAME, 'decodeData' ) ); @@ -180,6 +182,6 @@ public static function dataProvider() */ protected function setUp(): void { - $this->dataDecoder = new DataDecoder(); + $this->dataDecoder = new Decoder(); } } diff --git a/tests/unit_tests/coders/data_coders/data_decoders/JsonDataDecoderTest.php b/tests/unit_tests/Coder/Json/Data/DecoderTest.php similarity index 81% rename from tests/unit_tests/coders/data_coders/data_decoders/JsonDataDecoderTest.php rename to tests/unit_tests/Coder/Json/Data/DecoderTest.php index 9bebb4a..d16d22f 100644 --- a/tests/unit_tests/coders/data_coders/data_decoders/JsonDataDecoderTest.php +++ b/tests/unit_tests/Coder/Json/Data/DecoderTest.php @@ -9,12 +9,13 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Json\Data; use PHPUnit\Framework\TestCase; +use ExOrg\DataCoder\DataFileFixturesHelper; /** - * JsonDataDecoderTest. + * Json Data Decoder Test. * PHPUnit test class for JsonDataDecoder class. * * @package DataCoder @@ -23,8 +24,11 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class JsonDataDecoderTest extends TestCase +class DecoderTest extends TestCase { + const DECODER_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\Coder\Json\Data\Decoder'; + const DATA_FORMAT_INVALID_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\DataFormat\DataFormatInvalidException'; + /** * Decoded data format. */ @@ -51,7 +55,7 @@ class JsonDataDecoderTest extends TestCase public function testJsonDataDecoderClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\JsonDataDecoder') + class_exists(self::DECODER_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -63,7 +67,7 @@ public function testDecodeDataFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\JsonDataDecoder', + self::DECODER_FULLY_QUALIFIED_CLASS_NAME, 'decodeData' ) ); @@ -89,7 +93,7 @@ public function testDecodeDataWithNotStringData() */ public function testDecodeDataWithDataInIncorrectFormat() { - $this->expectException('\ExOrg\DataCoder\DataFormatInvalidException'); + $this->expectException(self::DATA_FORMAT_INVALID_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $data = ''; @@ -125,6 +129,6 @@ public static function setUpBeforeClass(): void */ protected function setUp(): void { - $this->jsonDataDecoder = new JsonDataDecoder(); + $this->jsonDataDecoder = new Decoder(); } } diff --git a/tests/unit_tests/coders/data_coders/data_decoders/YamlDataDecoderTest.php b/tests/unit_tests/Coder/Yaml/Data/DecoderTest.php similarity index 81% rename from tests/unit_tests/coders/data_coders/data_decoders/YamlDataDecoderTest.php rename to tests/unit_tests/Coder/Yaml/Data/DecoderTest.php index 668599b..e38e4f6 100644 --- a/tests/unit_tests/coders/data_coders/data_decoders/YamlDataDecoderTest.php +++ b/tests/unit_tests/Coder/Yaml/Data/DecoderTest.php @@ -9,12 +9,13 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Yaml\Data; use PHPUnit\Framework\TestCase; +use ExOrg\DataCoder\DataFileFixturesHelper; /** - * YamlDataDecoderTest. + * Yaml Data Decoder Test. * PHPUnit test class for YamlDataDecoder class. * * @package DataCoder @@ -23,8 +24,11 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class YamlDataDecoderTest extends TestCase +class DecoderTest extends TestCase { + const DECODER_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\Coder\Yaml\Data\Decoder'; + const DATA_FORMAT_INVALID_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\DataFormat\DataFormatInvalidException'; + /** * Decoded data format. */ @@ -51,7 +55,7 @@ class YamlDataDecoderTest extends TestCase public function testYamlDataDecoderClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\YamlDataDecoder') + class_exists(self::DECODER_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -63,7 +67,7 @@ public function testDecodeDataFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\YamlDataDecoder', + self::DECODER_FULLY_QUALIFIED_CLASS_NAME, 'decodeData' ) ); @@ -89,7 +93,7 @@ public function testDecodeDataWithNotStringData() */ public function testDecodeDataWithDataInIncorrectFormat() { - $this->expectException('\ExOrg\DataCoder\DataFormatInvalidException'); + $this->expectException(self::DATA_FORMAT_INVALID_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $data = ''; @@ -125,6 +129,6 @@ public static function setUpBeforeClass(): void */ protected function setUp(): void { - $this->yamlDataDecoder = new YamlDataDecoder(); + $this->yamlDataDecoder = new Decoder(); } } From 16693dde4bc27628ec1c2bfd1884dcb9805b00dc Mon Sep 17 00:00:00 2001 From: katheroine Date: Mon, 13 Nov 2023 11:57:17 +0100 Subject: [PATCH 14/26] Datafile Encoders classes namespaces changed, class file paths updated (ExOrg#107) --- .../Datafile/AbstractCoder.php} | 9 ++++++--- .../Datafile/Encoder.php} | 6 +++--- .../Json/Datafile/Encoder.php} | 9 +++++---- .../Yaml/Datafile/Encoder.php} | 7 ++++--- .../Datafile/EncoderTest.php} | 16 +++++++++------- tests/unit_tests/Coder/Json/Data/EncoderTest.php | 2 +- .../Json/Datafile/EncoderTest.php} | 15 +++++++++------ .../Yaml/Datafile/EncoderTest.php} | 15 +++++++++------ 8 files changed, 46 insertions(+), 33 deletions(-) rename src/{coders/datafile_coders/AbstractDatafileCoder.php => Coder/Datafile/AbstractCoder.php} (87%) rename src/{coders/datafile_coders/datafile_encoders/DatafileEncoder.php => Coder/Datafile/Encoder.php} (92%) rename src/{coders/datafile_coders/datafile_encoders/JsonDatafileEncoder.php => Coder/Json/Datafile/Encoder.php} (83%) rename src/{coders/datafile_coders/datafile_encoders/YamlDatafileEncoder.php => Coder/Yaml/Datafile/Encoder.php} (85%) rename tests/unit_tests/{coders/datafile_coders/datafile_encoders/DatafileEncoderTest.php => Coder/Datafile/EncoderTest.php} (93%) rename tests/unit_tests/{coders/datafile_coders/datafile_encoders/JsonDatafileEncoderTest.php => Coder/Json/Datafile/EncoderTest.php} (87%) rename tests/unit_tests/{coders/datafile_coders/datafile_encoders/YamlDatafileEncoderTest.php => Coder/Yaml/Datafile/EncoderTest.php} (87%) diff --git a/src/coders/datafile_coders/AbstractDatafileCoder.php b/src/Coder/Datafile/AbstractCoder.php similarity index 87% rename from src/coders/datafile_coders/AbstractDatafileCoder.php rename to src/Coder/Datafile/AbstractCoder.php index 80b96f6..2d1bac5 100644 --- a/src/coders/datafile_coders/AbstractDatafileCoder.php +++ b/src/Coder/Datafile/AbstractCoder.php @@ -9,10 +9,13 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Datafile; + +use ExOrg\DataCoder\DataFormat\DataFormatConfigurableTrait; +use ExOrg\DataCoder\File\File; /** - * AbstractDatafileCoder. + * Abstract Datafile Coder. * Abstract class for DatafileCoders * with configurable data format. * @@ -22,7 +25,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -abstract class AbstractDatafileCoder +abstract class AbstractCoder { use DataFormatConfigurableTrait; diff --git a/src/coders/datafile_coders/datafile_encoders/DatafileEncoder.php b/src/Coder/Datafile/Encoder.php similarity index 92% rename from src/coders/datafile_coders/datafile_encoders/DatafileEncoder.php rename to src/Coder/Datafile/Encoder.php index 7a5a024..ba68e4b 100644 --- a/src/coders/datafile_coders/datafile_encoders/DatafileEncoder.php +++ b/src/Coder/Datafile/Encoder.php @@ -9,13 +9,13 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Datafile; use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; use ExOrg\DataCoder\File\File; /** - * DatafileEncoder. + * Datafile Encoder. * Allows to encode data file * accordingly the data format set directly * or defined by file extension. @@ -26,7 +26,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class DatafileEncoder extends AbstractDatafileCoder +class Encoder extends AbstractCoder { use CoderBuildingTrait; diff --git a/src/coders/datafile_coders/datafile_encoders/JsonDatafileEncoder.php b/src/Coder/Json/Datafile/Encoder.php similarity index 83% rename from src/coders/datafile_coders/datafile_encoders/JsonDatafileEncoder.php rename to src/Coder/Json/Datafile/Encoder.php index fe0102c..4d1b599 100644 --- a/src/coders/datafile_coders/datafile_encoders/JsonDatafileEncoder.php +++ b/src/Coder/Json/Datafile/Encoder.php @@ -9,12 +9,13 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Json\Datafile; use ExOrg\DataCoder\File\File; +use ExOrg\DataCoder\Coder\Json\Data\Encoder as DataEncoder; /** - * JsonDatafileEncoder. + * Json Datafile Encoder. * Datafile encoder for JSON format. * * @package DataCoder @@ -23,7 +24,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class JsonDatafileEncoder +class Encoder { /** * Encode JSON data and write to the file. @@ -36,7 +37,7 @@ public function encodeFile($data, $filePath) { $file = new File($filePath); - $dataEncoder = new JsonDataEncoder(); + $dataEncoder = new DataEncoder(); $fileData = $dataEncoder->encodeData($data); $file->setContent($fileData); diff --git a/src/coders/datafile_coders/datafile_encoders/YamlDatafileEncoder.php b/src/Coder/Yaml/Datafile/Encoder.php similarity index 85% rename from src/coders/datafile_coders/datafile_encoders/YamlDatafileEncoder.php rename to src/Coder/Yaml/Datafile/Encoder.php index df93782..d3f4862 100644 --- a/src/coders/datafile_coders/datafile_encoders/YamlDatafileEncoder.php +++ b/src/Coder/Yaml/Datafile/Encoder.php @@ -9,9 +9,10 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Yaml\Datafile; use ExOrg\DataCoder\File\File; +use ExOrg\DataCoder\Coder\Yaml\Data\Encoder as DataEncoder; /** * YamlDatafileEncoder. @@ -23,7 +24,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class YamlDatafileEncoder +class Encoder { /** * Encode YAML data and write to the file. @@ -36,7 +37,7 @@ public function encodeFile($data, $filePath) { $file = new File($filePath); - $dataEncoder = new YamlDataEncoder(); + $dataEncoder = new DataEncoder(); $fileData = $dataEncoder->encodeData($data); $file->setContent($fileData); diff --git a/tests/unit_tests/coders/datafile_coders/datafile_encoders/DatafileEncoderTest.php b/tests/unit_tests/Coder/Datafile/EncoderTest.php similarity index 93% rename from tests/unit_tests/coders/datafile_coders/datafile_encoders/DatafileEncoderTest.php rename to tests/unit_tests/Coder/Datafile/EncoderTest.php index 0579ddb..b2d97ea 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_encoders/DatafileEncoderTest.php +++ b/tests/unit_tests/Coder/Datafile/EncoderTest.php @@ -9,13 +9,14 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Datafile; use PHPUnit\Framework\TestCase; +use ExOrg\DataCoder\DataFileFixturesHelper; use ExOrg\Decapsulator\ObjectDecapsulator; /** - * DatafileEncoderTest. + * Datafile Encoder Test. * PHPUnit test class for DatafileEncoder class. * * @package DataCoder @@ -24,8 +25,9 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class DatafileEncoderTest extends TestCase +class EncoderTest extends TestCase { + const ENCODER_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\Coder\Datafile\Encoder'; const CODER_CLASS_NOT_FOUND_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\CoderBuilder\CoderClassNotFoundException'; /** @@ -49,7 +51,7 @@ class DatafileEncoderTest extends TestCase public function testDatafileEncoderClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\DatafileEncoder') + class_exists(self::ENCODER_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -61,7 +63,7 @@ public function testSetDataFormatFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\DatafileEncoder', + self::ENCODER_FULLY_QUALIFIED_CLASS_NAME, 'setDataFormat' ) ); @@ -132,7 +134,7 @@ public function testEncodeFileFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\DatafileEncoder', + self::ENCODER_FULLY_QUALIFIED_CLASS_NAME, 'encodeFile' ) ); @@ -248,6 +250,6 @@ public static function setUpBeforeClass(): void */ protected function setUp(): void { - $this->datafileEncoder = new DatafileEncoder(); + $this->datafileEncoder = new Encoder(); } } diff --git a/tests/unit_tests/Coder/Json/Data/EncoderTest.php b/tests/unit_tests/Coder/Json/Data/EncoderTest.php index 9d0a336..bbc43b4 100644 --- a/tests/unit_tests/Coder/Json/Data/EncoderTest.php +++ b/tests/unit_tests/Coder/Json/Data/EncoderTest.php @@ -12,7 +12,7 @@ namespace ExOrg\DataCoder\Coder\Json\Data; use PHPUnit\Framework\TestCase; -use ExOrg\DataCoder\ObjectDecapsulator; +// use ExOrg\DataCoder\ObjectDecapsulator; use ExOrg\DataCoder\DataFileFixturesHelper; /** diff --git a/tests/unit_tests/coders/datafile_coders/datafile_encoders/JsonDatafileEncoderTest.php b/tests/unit_tests/Coder/Json/Datafile/EncoderTest.php similarity index 87% rename from tests/unit_tests/coders/datafile_coders/datafile_encoders/JsonDatafileEncoderTest.php rename to tests/unit_tests/Coder/Json/Datafile/EncoderTest.php index 3efeb9c..f5cc678 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_encoders/JsonDatafileEncoderTest.php +++ b/tests/unit_tests/Coder/Json/Datafile/EncoderTest.php @@ -9,13 +9,14 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Json\Datafile; use PHPUnit\Framework\TestCase; use ExOrg\Decapsulator\ObjectDecapsulator; +use ExOrg\DataCoder\DataFileFixturesHelper; /** - * JsonDatafileEncoderTest. + * Json Datafile Encoder Test. * PHPUnit test class for JsonDatafileEncoder class. * * @package DataCoder @@ -24,8 +25,10 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class JsonDatafileEncoderTest extends TestCase +class EncoderTest extends TestCase { + const ENCODER_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\Coder\Json\Datafile\Encoder'; + /** * Encoded data format. */ @@ -52,7 +55,7 @@ class JsonDatafileEncoderTest extends TestCase public function testJsonDatafileEncoderClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\JsonDatafileEncoder') + class_exists(self::ENCODER_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -64,7 +67,7 @@ public function testEncodeFileFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\JsonDatafileEncoder', + self::ENCODER_FULLY_QUALIFIED_CLASS_NAME, 'encodeFile' ) ); @@ -116,6 +119,6 @@ public static function setUpBeforeClass(): void */ protected function setUp(): void { - $this->jsonDatafileEncoder = new JsonDatafileEncoder(); + $this->jsonDatafileEncoder = new Encoder(); } } diff --git a/tests/unit_tests/coders/datafile_coders/datafile_encoders/YamlDatafileEncoderTest.php b/tests/unit_tests/Coder/Yaml/Datafile/EncoderTest.php similarity index 87% rename from tests/unit_tests/coders/datafile_coders/datafile_encoders/YamlDatafileEncoderTest.php rename to tests/unit_tests/Coder/Yaml/Datafile/EncoderTest.php index f7e717f..f1b14c2 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_encoders/YamlDatafileEncoderTest.php +++ b/tests/unit_tests/Coder/Yaml/Datafile/EncoderTest.php @@ -9,13 +9,14 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Yaml\Datafile; use PHPUnit\Framework\TestCase; use ExOrg\Decapsulator\ObjectDecapsulator; +use ExOrg\DataCoder\DataFileFixturesHelper; /** - * YamlDatafileEncoderTest. + * Yaml Datafile Encoder Test. * PHPUnit test class for YamlDatafileEncoder class. * * @package DataCoder @@ -24,8 +25,10 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class YamlDatafileEncoderTest extends TestCase +class EncoderTest extends TestCase { + const ENCODER_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\Coder\Yaml\Datafile\Encoder'; + /** * Encoded data format. */ @@ -52,7 +55,7 @@ class YamlDatafileEncoderTest extends TestCase public function testYamlDatafileEncoderClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\YamlDatafileEncoder') + class_exists(self::ENCODER_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -64,7 +67,7 @@ public function testEncodeFileFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\YamlDatafileEncoder', + self::ENCODER_FULLY_QUALIFIED_CLASS_NAME, 'encodeFile' ) ); @@ -116,6 +119,6 @@ public static function setUpBeforeClass(): void */ protected function setUp(): void { - $this->yamlDatafileEncoder = new YamlDatafileEncoder(); + $this->yamlDatafileEncoder = new Encoder(); } } From b3a3cf1ca7ca27938ca089b71421818e3776537a Mon Sep 17 00:00:00 2001 From: katheroine Date: Mon, 13 Nov 2023 15:16:56 +0100 Subject: [PATCH 15/26] Datafile Decoders classes namespaces changed, class file paths updated (ExOrg#107) --- .../Datafile/Decoder.php} | 6 +++--- .../Json/Datafile/Decoder.php} | 7 ++++--- .../Yaml/Datafile/Decoder.php} | 9 +++++---- .../Datafile/DecoderTest.php} | 14 ++++++++------ .../Json/Datafile/DecoderTest.php} | 17 ++++++++++------- .../Yaml/Datafile/DecoderTest.php} | 17 ++++++++++------- 6 files changed, 40 insertions(+), 30 deletions(-) rename src/{coders/datafile_coders/datafile_decoders/DatafileDecoder.php => Coder/Datafile/Decoder.php} (92%) rename src/{coders/datafile_coders/datafile_decoders/JsonDatafileDecoder.php => Coder/Json/Datafile/Decoder.php} (85%) rename src/{coders/datafile_coders/datafile_decoders/YamlDatafileDecoder.php => Coder/Yaml/Datafile/Decoder.php} (83%) rename tests/unit_tests/{coders/datafile_coders/datafile_decoders/DatafileDecoderTest.php => Coder/Datafile/DecoderTest.php} (94%) rename tests/unit_tests/{coders/datafile_coders/datafile_decoders/JsonDatafileDecoderTest.php => Coder/Json/Datafile/DecoderTest.php} (83%) rename tests/unit_tests/{coders/datafile_coders/datafile_decoders/YamlDatafileDecoderTest.php => Coder/Yaml/Datafile/DecoderTest.php} (83%) diff --git a/src/coders/datafile_coders/datafile_decoders/DatafileDecoder.php b/src/Coder/Datafile/Decoder.php similarity index 92% rename from src/coders/datafile_coders/datafile_decoders/DatafileDecoder.php rename to src/Coder/Datafile/Decoder.php index eb87b06..92d35c4 100644 --- a/src/coders/datafile_coders/datafile_decoders/DatafileDecoder.php +++ b/src/Coder/Datafile/Decoder.php @@ -9,13 +9,13 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Datafile; use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; use ExOrg\DataCoder\File\File; /** - * DatafileDecoder. + * Datafile Decoder. * Allows to decode data file * accordingly the data format set directly * or defined by file extension. @@ -26,7 +26,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class DatafileDecoder extends AbstractDatafileCoder +class Decoder extends AbstractCoder { use CoderBuildingTrait; diff --git a/src/coders/datafile_coders/datafile_decoders/JsonDatafileDecoder.php b/src/Coder/Json/Datafile/Decoder.php similarity index 85% rename from src/coders/datafile_coders/datafile_decoders/JsonDatafileDecoder.php rename to src/Coder/Json/Datafile/Decoder.php index 98d474d..a41988e 100644 --- a/src/coders/datafile_coders/datafile_decoders/JsonDatafileDecoder.php +++ b/src/Coder/Json/Datafile/Decoder.php @@ -9,9 +9,10 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Json\Datafile; use ExOrg\DataCoder\File\File; +use ExOrg\DataCoder\Coder\Json\Data\Decoder as DataDecoder; /** * JsonDatafileDecoder. @@ -23,7 +24,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class JsonDatafileDecoder +class Decoder { /** * Decode file content. @@ -38,7 +39,7 @@ public function decodeFile($filePath) $fileData = $file->getContent(); - $dataDecoder = new JsonDataDecoder(); + $dataDecoder = new DataDecoder(); $result = $dataDecoder->decodeData($fileData); return $result; diff --git a/src/coders/datafile_coders/datafile_decoders/YamlDatafileDecoder.php b/src/Coder/Yaml/Datafile/Decoder.php similarity index 83% rename from src/coders/datafile_coders/datafile_decoders/YamlDatafileDecoder.php rename to src/Coder/Yaml/Datafile/Decoder.php index 405216b..203c2fd 100644 --- a/src/coders/datafile_coders/datafile_decoders/YamlDatafileDecoder.php +++ b/src/Coder/Yaml/Datafile/Decoder.php @@ -9,12 +9,13 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Yaml\Datafile; use ExOrg\DataCoder\File\File; +use ExOrg\DataCoder\Coder\Yaml\Data\Decoder as DataDecoder; /** - * YamlDatafileDecoder. + * Yaml Datafile Decoder. * Datafile decoder for YAML format. * * @package DataCoder @@ -23,7 +24,7 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class YamlDatafileDecoder +class Decoder { /** * Decode file content. @@ -38,7 +39,7 @@ public function decodeFile($filePath) $fileData = $file->getContent(); - $dataDecoder = new YamlDataDecoder(); + $dataDecoder = new DataDecoder(); $result = $dataDecoder->decodeData($fileData); return $result; diff --git a/tests/unit_tests/coders/datafile_coders/datafile_decoders/DatafileDecoderTest.php b/tests/unit_tests/Coder/Datafile/DecoderTest.php similarity index 94% rename from tests/unit_tests/coders/datafile_coders/datafile_decoders/DatafileDecoderTest.php rename to tests/unit_tests/Coder/Datafile/DecoderTest.php index da0d687..cc83cd3 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_decoders/DatafileDecoderTest.php +++ b/tests/unit_tests/Coder/Datafile/DecoderTest.php @@ -9,9 +9,10 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Datafile; use PHPUnit\Framework\TestCase; +use ExOrg\DataCoder\DataFileFixturesHelper; use ExOrg\Decapsulator\ObjectDecapsulator; /** @@ -24,8 +25,9 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class DatafileDecoderTest extends TestCase +class DecoderTest extends TestCase { + const DECODER_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\Coder\Datafile\Decoder'; const FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\File\FileException'; const CODER_CLASS_NOT_FOUND_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\CoderBuilder\CoderClassNotFoundException'; @@ -50,7 +52,7 @@ class DatafileDecoderTest extends TestCase public function testDatafileDecoderClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\DatafileDecoder') + class_exists(self::DECODER_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -62,7 +64,7 @@ public function testSetDataFormatFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\DatafileDecoder', + self::DECODER_FULLY_QUALIFIED_CLASS_NAME, 'setDataFormat' ) ); @@ -131,7 +133,7 @@ public function testDecodeFileFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\DatafileDecoder', + self::DECODER_FULLY_QUALIFIED_CLASS_NAME, 'decodeFile' ) ); @@ -255,6 +257,6 @@ public static function setUpBeforeClass(): void */ protected function setUp(): void { - $this->datafileDecoder = new DatafileDecoder(); + $this->datafileDecoder = new Decoder(); } } diff --git a/tests/unit_tests/coders/datafile_coders/datafile_decoders/JsonDatafileDecoderTest.php b/tests/unit_tests/Coder/Json/Datafile/DecoderTest.php similarity index 83% rename from tests/unit_tests/coders/datafile_coders/datafile_decoders/JsonDatafileDecoderTest.php rename to tests/unit_tests/Coder/Json/Datafile/DecoderTest.php index b12590d..308c3ed 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_decoders/JsonDatafileDecoderTest.php +++ b/tests/unit_tests/Coder/Json/Datafile/DecoderTest.php @@ -9,13 +9,14 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Json\Datafile; use PHPUnit\Framework\TestCase; use ExOrg\Decapsulator\ObjectDecapsulator; +use ExOrg\DataCoder\DataFileFixturesHelper; /** - * JsonDatafileDecoderTest. + * Json Datafile Decoder Test. * PHPUnit test class for JsonDatafileDecoder class. * * @package DataCoder @@ -24,9 +25,11 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class JsonDatafileDecoderTest extends TestCase +class DecoderTest extends TestCase { + const DECODER_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\Coder\Json\Datafile\Decoder'; const FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\File\FileException'; + const DATA_FORMAT_INVALID_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\DataFormat\DataFormatInvalidException'; /** * Decoded data format. @@ -54,7 +57,7 @@ class JsonDatafileDecoderTest extends TestCase public function testJsonDatafileDecoderClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\JsonDatafileDecoder') + class_exists(self::DECODER_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -66,7 +69,7 @@ public function testDecodeFileFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\JsonDatafileDecoder', + self::DECODER_FULLY_QUALIFIED_CLASS_NAME, 'decodeFile' ) ); @@ -91,7 +94,7 @@ public function testDecodeFileWhenFileDoesNotExist() */ public function testDecodeFileWithIncorrectData() { - $this->expectException('\ExOrg\DataCoder\DataFormatInvalidException'); + $this->expectException(self::DATA_FORMAT_INVALID_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $dataFilePath = self::$dataFileFixturesHelper->buildEncodedFilePath('data.nonexistentformat'); @@ -127,6 +130,6 @@ public static function setUpBeforeClass(): void */ protected function setUp(): void { - $this->jsonDatafileDecoder = new JsonDatafileDecoder(); + $this->jsonDatafileDecoder = new Decoder(); } } diff --git a/tests/unit_tests/coders/datafile_coders/datafile_decoders/YamlDatafileDecoderTest.php b/tests/unit_tests/Coder/Yaml/Datafile/DecoderTest.php similarity index 83% rename from tests/unit_tests/coders/datafile_coders/datafile_decoders/YamlDatafileDecoderTest.php rename to tests/unit_tests/Coder/Yaml/Datafile/DecoderTest.php index 9c4e942..a1938a3 100644 --- a/tests/unit_tests/coders/datafile_coders/datafile_decoders/YamlDatafileDecoderTest.php +++ b/tests/unit_tests/Coder/Yaml/Datafile/DecoderTest.php @@ -9,13 +9,14 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Coder\Yaml\Datafile; use PHPUnit\Framework\TestCase; use ExOrg\Decapsulator\ObjectDecapsulator; +use ExOrg\DataCoder\DataFileFixturesHelper; /** - * YamlDatafileDecoderTest. + * Yaml Datafile Decoder Test. * PHPUnit test class for YamlDatafileDecoder class. * * @package DataCoder @@ -24,9 +25,11 @@ * @license http://opensource.org/licenses/MIT MIT License * @link https://github.com/ExOrg/php-data-coder */ -class YamlDatafileDecoderTest extends TestCase +class DecoderTest extends TestCase { + const DECODER_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\Coder\Yaml\Datafile\Decoder'; const FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\File\FileException'; + const DATA_FORMAT_INVALID_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\DataFormat\DataFormatInvalidException'; /** * Decoded data format. @@ -54,7 +57,7 @@ class YamlDatafileDecoderTest extends TestCase public function testYamlDatafileDecoderClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\YamlDatafileDecoder') + class_exists(self::DECODER_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -66,7 +69,7 @@ public function testDecodeFileFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\YamlDatafileDecoder', + self::DECODER_FULLY_QUALIFIED_CLASS_NAME, 'decodeFile' ) ); @@ -91,7 +94,7 @@ public function testDecodeFileWhenFileDoesNotExist() */ public function testDecodeFileWithIncorrectData() { - $this->expectException('\ExOrg\DataCoder\DataFormatInvalidException'); + $this->expectException(self::DATA_FORMAT_INVALID_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME); $dataFilePath = self::$dataFileFixturesHelper->buildEncodedFilePath('data.nonexistentformat'); @@ -127,6 +130,6 @@ public static function setUpBeforeClass(): void */ protected function setUp(): void { - $this->yamlDatafileDecoder = new YamlDatafileDecoder(); + $this->yamlDatafileDecoder = new Decoder(); } } From 5e0d5c578b9683b8a490c8111cf0be947663f044 Mon Sep 17 00:00:00 2001 From: katheroine Date: Tue, 14 Nov 2023 15:27:23 +0100 Subject: [PATCH 16/26] CoderBuildingTrait tests fixed (ExOrg#107) --- src/CoderBuilder/CoderBuildingTrait.php | 10 +---- .../DummyClassFormat1Decoder.php | 4 +- .../DummyClassFormat1Encoder.php | 4 +- .../DummyClassFormat1Nocoder.php | 4 +- .../DummyClassFormat2Decoder.php | 4 +- .../DummyClassFormat2Encoder.php | 4 +- .../DummyClassFormat2Nocoder.php | 4 +- .../DummyClassFormatNotRecognizedDecoder.php | 4 +- .../DummyClassFormatNotRecognizedEncoder.php | 4 +- .../DummyClassFormatNullDecoder.php | 4 +- .../DummyClassFormatNullEncoder.php | 4 +- .../Format1DummyClassDecoder.php | 4 +- .../Format1DummyClassEncoder.php | 4 +- .../Format1DummyClassNocoder.php | 4 +- .../Format2DummyClassDecoder.php | 4 +- .../Format2DummyClassEncoder.php | 4 +- .../Format2DummyClassNocoder.php | 4 +- .../FormatnotrecognizedDummyClassDecoder.php | 4 +- .../FormatnotrecognizedDummyClassEncoder.php | 4 +- .../CoderBuilder/CoderBuildingTraitTest.php | 43 +++++++++++-------- 20 files changed, 80 insertions(+), 45 deletions(-) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/DummyClassFormat1Decoder.php (87%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/DummyClassFormat1Encoder.php (87%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/DummyClassFormat1Nocoder.php (87%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/DummyClassFormat2Decoder.php (87%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/DummyClassFormat2Encoder.php (87%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/DummyClassFormat2Nocoder.php (87%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/DummyClassFormatNotRecognizedDecoder.php (87%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/DummyClassFormatNotRecognizedEncoder.php (87%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/DummyClassFormatNullDecoder.php (87%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/DummyClassFormatNullEncoder.php (87%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/Format1DummyClassDecoder.php (86%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/Format1DummyClassEncoder.php (86%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/Format1DummyClassNocoder.php (86%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/Format2DummyClassDecoder.php (86%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/Format2DummyClassEncoder.php (86%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/Format2DummyClassNocoder.php (86%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/FormatnotrecognizedDummyClassDecoder.php (87%) rename tests/testing_environment/classes/{ => CoderBuildingTraitUsing}/FormatnotrecognizedDummyClassEncoder.php (87%) diff --git a/src/CoderBuilder/CoderBuildingTrait.php b/src/CoderBuilder/CoderBuildingTrait.php index bf45629..bedcd9e 100644 --- a/src/CoderBuilder/CoderBuildingTrait.php +++ b/src/CoderBuilder/CoderBuildingTrait.php @@ -76,13 +76,7 @@ private function buildCoderClassName() $dataFormatPrefix = $this->establishDataFormatPrefix(); $coderTypePostfix = $this->extractCurrentClassNamePostfix(); - // $coderClassName = __NAMESPACE__ - // . '\\' - // . $dataFormatPrefix - // . 'Data' - // . $coderTypePostfix; - - $coderClassName = 'ExOrg\\DataCoder\Coder' + $coderClassName = 'ExOrg\\DataCoder\\Coder' . '\\' . $dataFormatPrefix . '\\' @@ -129,7 +123,7 @@ private function extractCurrentClassName() * into segmants * begun with upper case letter. * - * @return array: + * @return array */ private function splitCurrentClassName() { diff --git a/tests/testing_environment/classes/DummyClassFormat1Decoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat1Decoder.php similarity index 87% rename from tests/testing_environment/classes/DummyClassFormat1Decoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat1Decoder.php index 04e9fc8..0e974db 100644 --- a/tests/testing_environment/classes/DummyClassFormat1Decoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat1Decoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormat1Encoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat1Encoder.php similarity index 87% rename from tests/testing_environment/classes/DummyClassFormat1Encoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat1Encoder.php index 3dbd44f..4cf5247 100644 --- a/tests/testing_environment/classes/DummyClassFormat1Encoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat1Encoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormat1Nocoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat1Nocoder.php similarity index 87% rename from tests/testing_environment/classes/DummyClassFormat1Nocoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat1Nocoder.php index 6df0b6f..5f84a10 100644 --- a/tests/testing_environment/classes/DummyClassFormat1Nocoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat1Nocoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormat2Decoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat2Decoder.php similarity index 87% rename from tests/testing_environment/classes/DummyClassFormat2Decoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat2Decoder.php index da62aab..7898746 100644 --- a/tests/testing_environment/classes/DummyClassFormat2Decoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat2Decoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormat2Encoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat2Encoder.php similarity index 87% rename from tests/testing_environment/classes/DummyClassFormat2Encoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat2Encoder.php index 15bbf86..897a4f2 100644 --- a/tests/testing_environment/classes/DummyClassFormat2Encoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat2Encoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormat2Nocoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat2Nocoder.php similarity index 87% rename from tests/testing_environment/classes/DummyClassFormat2Nocoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat2Nocoder.php index 5de0aeb..f082d60 100644 --- a/tests/testing_environment/classes/DummyClassFormat2Nocoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat2Nocoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormatNotRecognizedDecoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedDecoder.php similarity index 87% rename from tests/testing_environment/classes/DummyClassFormatNotRecognizedDecoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedDecoder.php index 6b2e504..82cc184 100644 --- a/tests/testing_environment/classes/DummyClassFormatNotRecognizedDecoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedDecoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormatNotRecognizedEncoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedEncoder.php similarity index 87% rename from tests/testing_environment/classes/DummyClassFormatNotRecognizedEncoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedEncoder.php index 01734ee..3256b0d 100644 --- a/tests/testing_environment/classes/DummyClassFormatNotRecognizedEncoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedEncoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormatNullDecoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNullDecoder.php similarity index 87% rename from tests/testing_environment/classes/DummyClassFormatNullDecoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNullDecoder.php index f88a16e..27421f8 100644 --- a/tests/testing_environment/classes/DummyClassFormatNullDecoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNullDecoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/DummyClassFormatNullEncoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNullEncoder.php similarity index 87% rename from tests/testing_environment/classes/DummyClassFormatNullEncoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNullEncoder.php index 312be97..c996cbc 100644 --- a/tests/testing_environment/classes/DummyClassFormatNullEncoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNullEncoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format1DummyClassDecoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/Format1DummyClassDecoder.php similarity index 86% rename from tests/testing_environment/classes/Format1DummyClassDecoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/Format1DummyClassDecoder.php index 8b315a4..7d6bd07 100644 --- a/tests/testing_environment/classes/Format1DummyClassDecoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/Format1DummyClassDecoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format1DummyClassEncoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/Format1DummyClassEncoder.php similarity index 86% rename from tests/testing_environment/classes/Format1DummyClassEncoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/Format1DummyClassEncoder.php index c970dd8..ffe9de8 100644 --- a/tests/testing_environment/classes/Format1DummyClassEncoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/Format1DummyClassEncoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format1DummyClassNocoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/Format1DummyClassNocoder.php similarity index 86% rename from tests/testing_environment/classes/Format1DummyClassNocoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/Format1DummyClassNocoder.php index 4bfffe2..8259104 100644 --- a/tests/testing_environment/classes/Format1DummyClassNocoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/Format1DummyClassNocoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format2DummyClassDecoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/Format2DummyClassDecoder.php similarity index 86% rename from tests/testing_environment/classes/Format2DummyClassDecoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/Format2DummyClassDecoder.php index af220a3..64efd9c 100644 --- a/tests/testing_environment/classes/Format2DummyClassDecoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/Format2DummyClassDecoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format2DummyClassEncoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/Format2DummyClassEncoder.php similarity index 86% rename from tests/testing_environment/classes/Format2DummyClassEncoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/Format2DummyClassEncoder.php index ac4163a..bc0d2cc 100644 --- a/tests/testing_environment/classes/Format2DummyClassEncoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/Format2DummyClassEncoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/Format2DummyClassNocoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/Format2DummyClassNocoder.php similarity index 86% rename from tests/testing_environment/classes/Format2DummyClassNocoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/Format2DummyClassNocoder.php index 2f3b213..daa9ae8 100644 --- a/tests/testing_environment/classes/Format2DummyClassNocoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/Format2DummyClassNocoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/FormatnotrecognizedDummyClassDecoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassDecoder.php similarity index 87% rename from tests/testing_environment/classes/FormatnotrecognizedDummyClassDecoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassDecoder.php index 055a145..e1d37a2 100644 --- a/tests/testing_environment/classes/FormatnotrecognizedDummyClassDecoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassDecoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/testing_environment/classes/FormatnotrecognizedDummyClassEncoder.php b/tests/testing_environment/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassEncoder.php similarity index 87% rename from tests/testing_environment/classes/FormatnotrecognizedDummyClassEncoder.php rename to tests/testing_environment/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassEncoder.php index 2f684c4..e056f0f 100644 --- a/tests/testing_environment/classes/FormatnotrecognizedDummyClassEncoder.php +++ b/tests/testing_environment/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassEncoder.php @@ -9,7 +9,9 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder\CoderBuilder; +namespace ExOrg\DataCoder\CoderBuildingTraitUsing; + +use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait; /** * Dummy class for testing diff --git a/tests/unit_tests/CoderBuilder/CoderBuildingTraitTest.php b/tests/unit_tests/CoderBuilder/CoderBuildingTraitTest.php index 6ed23c7..9c2c42e 100644 --- a/tests/unit_tests/CoderBuilder/CoderBuildingTraitTest.php +++ b/tests/unit_tests/CoderBuilder/CoderBuildingTraitTest.php @@ -29,7 +29,8 @@ class CoderBuildingTraitTest extends TestCase * Namespace of the dummy coders classes * used to test trait. */ - const DUMMY_CODERS_NAMESPACE = __NAMESPACE__; + const CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE = 'ExOrg\DataCoder\CoderBuildingTraitUsing'; + const CODERS_NAMESPACE = 'ExOrg\DataCoder\Coder'; const CODE_BUILDING_TRAIT_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait'; const CODER_CLASS_NOT_FOUND_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\CoderBuilder\CoderClassNotFoundException'; @@ -131,10 +132,12 @@ public function testBuildCoder($traitUsingClassObject, $expectedCoderClass) public static function traitUsingClassObjectsWithImproperPostfixProvider() { return array( - array(new DummyClassFormat1Nocoder()), - array(new DummyClassFormat2Nocoder()), - array(new Format1DummyClassNocoder()), - array(new Format2DummyClassNocoder()), + // Classes with explicitly defined dataFormat + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\DummyClassFormat1Nocoder')()), + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\DummyClassFormat2Nocoder')()), + // Classes with no explicitly defined dataFormat (it's established from the class name first part) + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\Format1DummyClassNocoder')()), + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\Format2DummyClassNocoder')()), ); } @@ -147,8 +150,8 @@ public static function traitUsingClassObjectsWithImproperPostfixProvider() public static function traitUsingClassObjectsWithImproperPrefixProvider() { return array( - array(new FormatnotrecognizedDummyClassEncoder()), - array(new FormatnotrecognizedDummyClassDecoder()), + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\FormatnotrecognizedDummyClassEncoder')()), + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\FormatnotrecognizedDummyClassDecoder')()), ); } @@ -161,10 +164,10 @@ public static function traitUsingClassObjectsWithImproperPrefixProvider() public static function traitUsingClassObjectsWithImproperDataFormatProvider() { return array( - array(new DummyClassFormatNullEncoder()), - array(new DummyClassFormatNullDecoder()), - array(new DummyClassFormatNotRecognizedEncoder()), - array(new DummyClassFormatNotRecognizedDecoder()), + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\DummyClassFormatNullEncoder')()), + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\DummyClassFormatNullDecoder')()), + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\DummyClassFormatNotRecognizedEncoder')()), + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\DummyClassFormatNotRecognizedDecoder')()), ); } @@ -179,14 +182,16 @@ public static function traitUsingClassObjectsWithImproperDataFormatProvider() public static function traitUsingClassObjectsAndBuiltCoderClassesProvider() { return array( - array(new DummyClassFormat1Encoder(), self::DUMMY_CODERS_NAMESPACE . '\Format1DataEncoder'), - array(new DummyClassFormat1Decoder(), self::DUMMY_CODERS_NAMESPACE . '\Format1DataDecoder'), - array(new DummyClassFormat2Encoder(), self::DUMMY_CODERS_NAMESPACE . '\Format2DataEncoder'), - array(new DummyClassFormat2Decoder(), self::DUMMY_CODERS_NAMESPACE . '\Format2DataDecoder'), - array(new Format1DummyClassEncoder(), self::DUMMY_CODERS_NAMESPACE . '\Format1DataEncoder'), - array(new Format1DummyClassDecoder(), self::DUMMY_CODERS_NAMESPACE . '\Format1DataDecoder'), - array(new Format2DummyClassEncoder(), self::DUMMY_CODERS_NAMESPACE . '\Format2DataEncoder'), - array(new Format2DummyClassDecoder(), self::DUMMY_CODERS_NAMESPACE . '\Format2DataDecoder'), + // Classes with explicitly defined dataFormat + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\DummyClassFormat1Encoder')(), self::CODERS_NAMESPACE . '\Format1\Data\Encoder'), + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\DummyClassFormat1Decoder')(), self::CODERS_NAMESPACE . '\Format1\Data\Decoder'), + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\DummyClassFormat2Encoder')(), self::CODERS_NAMESPACE . '\Format2\Data\Encoder'), + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\DummyClassFormat2Decoder')(), self::CODERS_NAMESPACE . '\Format2\Data\Decoder'), + // Classes with no explicitly defined dataFormat (it's established from the class name first part) + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\Format1DummyClassEncoder')(), self::CODERS_NAMESPACE . '\Format1\Data\Encoder'), + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\Format1DummyClassDecoder')(), self::CODERS_NAMESPACE . '\Format1\Data\Decoder'), + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\Format2DummyClassEncoder')(), self::CODERS_NAMESPACE . '\Format2\Data\Encoder'), + array(new (self::CODER_BUILDING_TRAIT_USING_CODERS_NAMESPACE . '\Format2DummyClassDecoder')(), self::CODERS_NAMESPACE . '\Format2\Data\Decoder'), ); } } From 907efbd33bf955851188ccd85dd25e326d8d7fd4 Mon Sep 17 00:00:00 2001 From: katheroine Date: Wed, 15 Nov 2023 08:52:27 +0100 Subject: [PATCH 17/26] Composer autoloading configuration updated (ExOrg#107) --- composer.json | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/composer.json b/composer.json index 75f4d33..36bcf52 100644 --- a/composer.json +++ b/composer.json @@ -29,15 +29,7 @@ "autoload": { "psr-4": { "ExOrg\\DataCoder\\": [ - "src/", - "src/coders", - "src/coders/data_coders/", - "src/coders/data_coders/data_encoders/", - "src/coders/data_coders/data_decoders/", - "src/coders/datafile_coders/", - "src/coders/datafile_coders/datafile_encoders/", - "src/coders/datafile_coders/datafile_decoders/", - "src/data_format/" + "src/" ] } }, @@ -45,19 +37,8 @@ "psr-4": { "ExOrg\\DataCoder\\": [ "tests/unit_tests/", - "tests/unit_tests/coders/", - "tests/unit_tests/coders/data_coders/", - "tests/unit_tests/coders/data_coders/data_encoders/", - "tests/unit_tests/coders/data_coders/data_decoders/", - "tests/unit_tests/coders/datafile_coders/", - "tests/unit_tests/coders/datafile_coders/datafile_encoders/", - "tests/unit_tests/coders/datafile_coders/datafile_decoders/", - "tests/unit_tests/data_format/", "tests/testing_environment/helpers/", "tests/testing_environment/classes/" - ], - "ExOrg\\DataCoder\\CoderBuilder\\": [ - "tests/testing_environment/classes" ] } }, From 151217a265d074324dba14f937c05a9c4e81fd12 Mon Sep 17 00:00:00 2001 From: katheroine Date: Wed, 15 Nov 2023 08:53:10 +0100 Subject: [PATCH 18/26] Git ignoring configuration updated (ExOrg#107) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 42a6fdd..606de70 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ composer.lock vendor/ +.phpunit.result.cache From 67908aa47ae2dcc3935266db60d6fdb363972b0e Mon Sep 17 00:00:00 2001 From: katheroine Date: Wed, 15 Nov 2023 09:25:29 +0100 Subject: [PATCH 19/26] DataFileFixturesHelper class namespace changed, class file path updated (ExOrg#107) --- .../unit_tests/Coder/Datafile/DecoderTest.php | 2 +- .../unit_tests/Coder/Datafile/EncoderTest.php | 2 +- .../Coder/Json/Data/DecoderTest.php | 2 +- .../Coder/Json/Data/EncoderTest.php | 2 +- .../Coder/Json/Datafile/DecoderTest.php | 2 +- .../Coder/Json/Datafile/EncoderTest.php | 2 +- .../Coder/Yaml/Data/DecoderTest.php | 2 +- .../Coder/Yaml/Data/EncoderTest.php | 2 +- .../Coder/Yaml/Datafile/DecoderTest.php | 2 +- .../Coder/Yaml/Datafile/EncoderTest.php | 2 +- .../Fixture}/DataFileFixturesHelper.php | 6 +-- .../Fixture}/DataFileFixturesHelperTest.php | 40 ++++++++++++------- 12 files changed, 38 insertions(+), 28 deletions(-) rename tests/{testing_environment/helpers => unit_tests/Fixture}/DataFileFixturesHelper.php (97%) rename tests/{testing_environment/helpers => unit_tests/Fixture}/DataFileFixturesHelperTest.php (79%) diff --git a/tests/unit_tests/Coder/Datafile/DecoderTest.php b/tests/unit_tests/Coder/Datafile/DecoderTest.php index cc83cd3..b6ddf10 100644 --- a/tests/unit_tests/Coder/Datafile/DecoderTest.php +++ b/tests/unit_tests/Coder/Datafile/DecoderTest.php @@ -12,7 +12,7 @@ namespace ExOrg\DataCoder\Coder\Datafile; use PHPUnit\Framework\TestCase; -use ExOrg\DataCoder\DataFileFixturesHelper; +use ExOrg\DataCoder\Fixture\DataFileFixturesHelper; use ExOrg\Decapsulator\ObjectDecapsulator; /** diff --git a/tests/unit_tests/Coder/Datafile/EncoderTest.php b/tests/unit_tests/Coder/Datafile/EncoderTest.php index b2d97ea..39ad971 100644 --- a/tests/unit_tests/Coder/Datafile/EncoderTest.php +++ b/tests/unit_tests/Coder/Datafile/EncoderTest.php @@ -12,7 +12,7 @@ namespace ExOrg\DataCoder\Coder\Datafile; use PHPUnit\Framework\TestCase; -use ExOrg\DataCoder\DataFileFixturesHelper; +use ExOrg\DataCoder\Fixture\DataFileFixturesHelper; use ExOrg\Decapsulator\ObjectDecapsulator; /** diff --git a/tests/unit_tests/Coder/Json/Data/DecoderTest.php b/tests/unit_tests/Coder/Json/Data/DecoderTest.php index d16d22f..92cd9b5 100644 --- a/tests/unit_tests/Coder/Json/Data/DecoderTest.php +++ b/tests/unit_tests/Coder/Json/Data/DecoderTest.php @@ -12,7 +12,7 @@ namespace ExOrg\DataCoder\Coder\Json\Data; use PHPUnit\Framework\TestCase; -use ExOrg\DataCoder\DataFileFixturesHelper; +use ExOrg\DataCoder\Fixture\DataFileFixturesHelper; /** * Json Data Decoder Test. diff --git a/tests/unit_tests/Coder/Json/Data/EncoderTest.php b/tests/unit_tests/Coder/Json/Data/EncoderTest.php index bbc43b4..e2465cb 100644 --- a/tests/unit_tests/Coder/Json/Data/EncoderTest.php +++ b/tests/unit_tests/Coder/Json/Data/EncoderTest.php @@ -13,7 +13,7 @@ use PHPUnit\Framework\TestCase; // use ExOrg\DataCoder\ObjectDecapsulator; -use ExOrg\DataCoder\DataFileFixturesHelper; +use ExOrg\DataCoder\Fixture\DataFileFixturesHelper; /** * Json Data Encoder Test. diff --git a/tests/unit_tests/Coder/Json/Datafile/DecoderTest.php b/tests/unit_tests/Coder/Json/Datafile/DecoderTest.php index 308c3ed..ce071f7 100644 --- a/tests/unit_tests/Coder/Json/Datafile/DecoderTest.php +++ b/tests/unit_tests/Coder/Json/Datafile/DecoderTest.php @@ -13,7 +13,7 @@ use PHPUnit\Framework\TestCase; use ExOrg\Decapsulator\ObjectDecapsulator; -use ExOrg\DataCoder\DataFileFixturesHelper; +use ExOrg\DataCoder\Fixture\DataFileFixturesHelper; /** * Json Datafile Decoder Test. diff --git a/tests/unit_tests/Coder/Json/Datafile/EncoderTest.php b/tests/unit_tests/Coder/Json/Datafile/EncoderTest.php index f5cc678..3b536da 100644 --- a/tests/unit_tests/Coder/Json/Datafile/EncoderTest.php +++ b/tests/unit_tests/Coder/Json/Datafile/EncoderTest.php @@ -13,7 +13,7 @@ use PHPUnit\Framework\TestCase; use ExOrg\Decapsulator\ObjectDecapsulator; -use ExOrg\DataCoder\DataFileFixturesHelper; +use ExOrg\DataCoder\Fixture\DataFileFixturesHelper; /** * Json Datafile Encoder Test. diff --git a/tests/unit_tests/Coder/Yaml/Data/DecoderTest.php b/tests/unit_tests/Coder/Yaml/Data/DecoderTest.php index e38e4f6..6c89b8f 100644 --- a/tests/unit_tests/Coder/Yaml/Data/DecoderTest.php +++ b/tests/unit_tests/Coder/Yaml/Data/DecoderTest.php @@ -12,7 +12,7 @@ namespace ExOrg\DataCoder\Coder\Yaml\Data; use PHPUnit\Framework\TestCase; -use ExOrg\DataCoder\DataFileFixturesHelper; +use ExOrg\DataCoder\Fixture\DataFileFixturesHelper; /** * Yaml Data Decoder Test. diff --git a/tests/unit_tests/Coder/Yaml/Data/EncoderTest.php b/tests/unit_tests/Coder/Yaml/Data/EncoderTest.php index 1288683..5566a4c 100644 --- a/tests/unit_tests/Coder/Yaml/Data/EncoderTest.php +++ b/tests/unit_tests/Coder/Yaml/Data/EncoderTest.php @@ -12,7 +12,7 @@ namespace ExOrg\DataCoder\Coder\Yaml\Data; use PHPUnit\Framework\TestCase; -use ExOrg\DataCoder\DataFileFixturesHelper; +use ExOrg\DataCoder\Fixture\DataFileFixturesHelper; /** * Yaml Data Encoder Test. diff --git a/tests/unit_tests/Coder/Yaml/Datafile/DecoderTest.php b/tests/unit_tests/Coder/Yaml/Datafile/DecoderTest.php index a1938a3..318bbda 100644 --- a/tests/unit_tests/Coder/Yaml/Datafile/DecoderTest.php +++ b/tests/unit_tests/Coder/Yaml/Datafile/DecoderTest.php @@ -13,7 +13,7 @@ use PHPUnit\Framework\TestCase; use ExOrg\Decapsulator\ObjectDecapsulator; -use ExOrg\DataCoder\DataFileFixturesHelper; +use ExOrg\DataCoder\Fixture\DataFileFixturesHelper; /** * Yaml Datafile Decoder Test. diff --git a/tests/unit_tests/Coder/Yaml/Datafile/EncoderTest.php b/tests/unit_tests/Coder/Yaml/Datafile/EncoderTest.php index f1b14c2..02c5731 100644 --- a/tests/unit_tests/Coder/Yaml/Datafile/EncoderTest.php +++ b/tests/unit_tests/Coder/Yaml/Datafile/EncoderTest.php @@ -13,7 +13,7 @@ use PHPUnit\Framework\TestCase; use ExOrg\Decapsulator\ObjectDecapsulator; -use ExOrg\DataCoder\DataFileFixturesHelper; +use ExOrg\DataCoder\Fixture\DataFileFixturesHelper; /** * Yaml Datafile Encoder Test. diff --git a/tests/testing_environment/helpers/DataFileFixturesHelper.php b/tests/unit_tests/Fixture/DataFileFixturesHelper.php similarity index 97% rename from tests/testing_environment/helpers/DataFileFixturesHelper.php rename to tests/unit_tests/Fixture/DataFileFixturesHelper.php index ac7a3c9..e6e8a73 100644 --- a/tests/testing_environment/helpers/DataFileFixturesHelper.php +++ b/tests/unit_tests/Fixture/DataFileFixturesHelper.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Fixture; /** - * DataFileFixturesHelper. + * Data File Fixtures Helper. * Helps to handle data file fixtures. * * @package DataCoder @@ -29,7 +29,7 @@ class DataFileFixturesHelper * They are inputs and the expected results * of the encoding/decoding operations. */ - const FILES_DIRECTORY = '../data'; + const FILES_DIRECTORY = '../../testing_environment/data'; /** * Directory with the files containing encoded data diff --git a/tests/testing_environment/helpers/DataFileFixturesHelperTest.php b/tests/unit_tests/Fixture/DataFileFixturesHelperTest.php similarity index 79% rename from tests/testing_environment/helpers/DataFileFixturesHelperTest.php rename to tests/unit_tests/Fixture/DataFileFixturesHelperTest.php index 8385c89..f3b8162 100644 --- a/tests/testing_environment/helpers/DataFileFixturesHelperTest.php +++ b/tests/unit_tests/Fixture/DataFileFixturesHelperTest.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -namespace ExOrg\DataCoder; +namespace ExOrg\DataCoder\Fixture; use PHPUnit\Framework\TestCase; /** - * DataFileFixturesHelperTest. + * Data File Fixtures Helper Test. * PHPUnit base test class for * DataFileFixturesHelper. * @@ -26,6 +26,16 @@ */ class DataFileFixturesHelperTest extends TestCase { + const DATAFILE_FIXTURES_HELPER_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\Fixture\DataFileFixturesHelper'; + + /** + * Directory with the files containing data + * in various formats. + * They are inputs and the expected results + * of the encoding/decoding operations. + */ + const FILES_DIRECTORY = '../../testing_environment/data'; + /** * Instance of tested class. * @@ -34,13 +44,13 @@ class DataFileFixturesHelperTest extends TestCase private $dataFileFixturesHelper = null; /** - * Test if ExOrg\DataCoder\DataFileFixturesHelper class + * Test if ExOrg\DataCoder\Fixture\DataFileFixturesHelper class * has been created. */ public function testDataCodersTestHelperClassExists() { $this->assertTrue( - class_exists('ExOrg\DataCoder\DataFileFixturesHelper') + class_exists(self::DATAFILE_FIXTURES_HELPER_FULLY_QUALIFIED_CLASS_NAME) ); } @@ -52,7 +62,7 @@ public function testSetDataFormatFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\DataFileFixturesHelper', + self::DATAFILE_FIXTURES_HELPER_FULLY_QUALIFIED_CLASS_NAME, 'setDataFormat' ) ); @@ -66,7 +76,7 @@ public function testLoadEncodedDataFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\DataFileFixturesHelper', + self::DATAFILE_FIXTURES_HELPER_FULLY_QUALIFIED_CLASS_NAME, 'loadEncodedData' ) ); @@ -106,7 +116,7 @@ public function testLoadDecodedDataFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\DataFileFixturesHelper', + self::DATAFILE_FIXTURES_HELPER_FULLY_QUALIFIED_CLASS_NAME, 'loadDecodedData' ) ); @@ -148,7 +158,7 @@ public function testBuildEncodedFilePathFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\DataFileFixturesHelper', + self::DATAFILE_FIXTURES_HELPER_FULLY_QUALIFIED_CLASS_NAME, 'buildEncodedFilePath' ) ); @@ -160,7 +170,7 @@ public function testBuildEncodedFilePathFunctionExists() */ public function testBuildEncodedFilePath() { - $expectedPath = realpath(__DIR__ . '/../data/encoded/data.self-test'); + $expectedPath = realpath(__DIR__ . DIRECTORY_SEPARATOR . self::FILES_DIRECTORY . '/encoded/data.self-test'); $actualPath = $this->dataFileFixturesHelper->buildEncodedFilePath('data.self-test'); $this->assertEquals($expectedPath, $actualPath); @@ -174,7 +184,7 @@ public function testBuildDecodedFilePathFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\DataFileFixturesHelper', + self::DATAFILE_FIXTURES_HELPER_FULLY_QUALIFIED_CLASS_NAME, 'buildDecodedFilePath' ) ); @@ -186,7 +196,7 @@ public function testBuildDecodedFilePathFunctionExists() */ public function testBuildDecodedFilePath() { - $expectedPath = realpath(__DIR__ . '/../data/decoded/self-test.php'); + $expectedPath = realpath(__DIR__ . DIRECTORY_SEPARATOR . self::FILES_DIRECTORY . '/decoded/self-test.php'); $actualPath = $this->dataFileFixturesHelper->buildDecodedFilePath('self-test.php'); $this->assertEquals($expectedPath, $actualPath); @@ -200,7 +210,7 @@ public function testBuildCreatedFilePathFunctionExists() { $this->assertTrue( method_exists( - 'ExOrg\DataCoder\DataFileFixturesHelper', + self::DATAFILE_FIXTURES_HELPER_FULLY_QUALIFIED_CLASS_NAME, 'buildCreatedFilePath' ) ); @@ -212,7 +222,7 @@ public function testBuildCreatedFilePathFunctionExists() */ public function testBuildCreatedFilePath() { - $expectedPath = realpath(__DIR__ . '/../data/created/') . DIRECTORY_SEPARATOR . 'self-test'; + $expectedPath = realpath(__DIR__ . DIRECTORY_SEPARATOR . self::FILES_DIRECTORY . '/created/') . DIRECTORY_SEPARATOR . 'self-test'; $actualPath = $this->dataFileFixturesHelper->buildCreatedFilePath('self-test'); $this->assertEquals($expectedPath, $actualPath); @@ -235,7 +245,7 @@ protected function setUp(): void */ private function writeContentToSelfTestEncodedFile($content) { - $filePath = __DIR__ . "/../data/encoded/data.self-test"; + $filePath = __DIR__ . DIRECTORY_SEPARATOR . self::FILES_DIRECTORY . '/encoded/data.self-test'; file_put_contents($filePath, $content); } @@ -253,7 +263,7 @@ private function writeResultToSelfTestDecodedFile($result) } $content .= ');'; - $filePath = __DIR__ . "/../data/decoded/self-test.php"; + $filePath = __DIR__ . DIRECTORY_SEPARATOR . self::FILES_DIRECTORY . '/decoded/self-test.php'; file_put_contents($filePath, $content); } } From e37db2c5cba96398015bef8a165ddcc8394184e5 Mon Sep 17 00:00:00 2001 From: katheroine Date: Wed, 15 Nov 2023 09:56:16 +0100 Subject: [PATCH 20/26] Composer autoloading configuration updated (ExOrg#107) --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 36bcf52..23e4d3b 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,6 @@ "psr-4": { "ExOrg\\DataCoder\\": [ "tests/unit_tests/", - "tests/testing_environment/helpers/", "tests/testing_environment/classes/" ] } From 1b753faeceff3354cabbd01e520fb823d586c1d0 Mon Sep 17 00:00:00 2001 From: katheroine Date: Wed, 15 Nov 2023 11:33:30 +0100 Subject: [PATCH 21/26] testing_environment directory renamed to fixtures (ExOrg#107) --- composer.json | 2 +- .../classes/Coder/Format/Data/Decoder.php | 0 .../classes/Coder/Format/Data/Encoder.php | 0 .../classes/Coder/Format1/Data/Decoder.php | 0 .../classes/Coder/Format1/Data/Encoder.php | 0 .../classes/Coder/Format2/Data/Decoder.php | 0 .../classes/Coder/Format2/Data/Encoder.php | 0 .../classes/Coder/Format3/Data/Decoder.php | 0 .../classes/Coder/Format3/Data/Encoder.php | 0 .../CoderBuildingTraitUsing/DummyClassFormat1Decoder.php | 0 .../CoderBuildingTraitUsing/DummyClassFormat1Encoder.php | 0 .../CoderBuildingTraitUsing/DummyClassFormat1Nocoder.php | 0 .../CoderBuildingTraitUsing/DummyClassFormat2Decoder.php | 0 .../CoderBuildingTraitUsing/DummyClassFormat2Encoder.php | 0 .../CoderBuildingTraitUsing/DummyClassFormat2Nocoder.php | 0 .../DummyClassFormatNotRecognizedDecoder.php | 0 .../DummyClassFormatNotRecognizedEncoder.php | 0 .../CoderBuildingTraitUsing/DummyClassFormatNullDecoder.php | 0 .../CoderBuildingTraitUsing/DummyClassFormatNullEncoder.php | 0 .../CoderBuildingTraitUsing/Format1DummyClassDecoder.php | 0 .../CoderBuildingTraitUsing/Format1DummyClassEncoder.php | 0 .../CoderBuildingTraitUsing/Format1DummyClassNocoder.php | 0 .../CoderBuildingTraitUsing/Format2DummyClassDecoder.php | 0 .../CoderBuildingTraitUsing/Format2DummyClassEncoder.php | 0 .../CoderBuildingTraitUsing/Format2DummyClassNocoder.php | 0 .../FormatnotrecognizedDummyClassDecoder.php | 0 .../FormatnotrecognizedDummyClassEncoder.php | 0 tests/{testing_environment => fixtures}/data/decoded/.gitignore | 0 tests/{testing_environment => fixtures}/data/decoded/json.php | 0 tests/{testing_environment => fixtures}/data/decoded/yaml.php | 0 tests/{testing_environment => fixtures}/data/encoded/.gitignore | 0 tests/{testing_environment => fixtures}/data/encoded/data | 0 .../data/encoded/data.anotherformat | 0 .../{testing_environment => fixtures}/data/encoded/data.format | 0 tests/{testing_environment => fixtures}/data/encoded/data.json | 0 .../data/encoded/data.nonexistentformat | 0 tests/{testing_environment => fixtures}/data/encoded/data.yaml | 0 .../files/directory/file-for-read | 0 .../files/directory/file-for-write | 0 tests/{testing_environment => fixtures}/files/file-for-read | 0 tests/{testing_environment => fixtures}/files/file-for-read.dat | 0 tests/{testing_environment => fixtures}/files/file-for-read.ext | 0 tests/{testing_environment => fixtures}/files/file-for-write | 0 .../{testing_environment => fixtures}/files/file-for-write.dat | 0 .../{testing_environment => fixtures}/files/file-for-write.ext | 0 tests/{testing_environment => fixtures}/files/self-test | 0 .../files/unreadable-directory/file-for-read | 0 tests/{testing_environment => fixtures}/files/unreadable-file | 0 .../files/unwritable-directory/file-for-write | 0 tests/{testing_environment => fixtures}/files/unwritable-file | 0 tests/testing_environment/data/created/.gitignore | 1 - tests/unit_tests/File/FileTest.php | 2 +- tests/unit_tests/Fixture/DataFileFixturesHelper.php | 2 +- tests/unit_tests/Fixture/DataFileFixturesHelperTest.php | 2 +- 54 files changed, 4 insertions(+), 5 deletions(-) rename tests/{testing_environment => fixtures}/classes/Coder/Format/Data/Decoder.php (100%) rename tests/{testing_environment => fixtures}/classes/Coder/Format/Data/Encoder.php (100%) rename tests/{testing_environment => fixtures}/classes/Coder/Format1/Data/Decoder.php (100%) rename tests/{testing_environment => fixtures}/classes/Coder/Format1/Data/Encoder.php (100%) rename tests/{testing_environment => fixtures}/classes/Coder/Format2/Data/Decoder.php (100%) rename tests/{testing_environment => fixtures}/classes/Coder/Format2/Data/Encoder.php (100%) rename tests/{testing_environment => fixtures}/classes/Coder/Format3/Data/Decoder.php (100%) rename tests/{testing_environment => fixtures}/classes/Coder/Format3/Data/Encoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/DummyClassFormat1Decoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/DummyClassFormat1Encoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/DummyClassFormat1Nocoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/DummyClassFormat2Decoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/DummyClassFormat2Encoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/DummyClassFormat2Nocoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedDecoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedEncoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/DummyClassFormatNullDecoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/DummyClassFormatNullEncoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/Format1DummyClassDecoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/Format1DummyClassEncoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/Format1DummyClassNocoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/Format2DummyClassDecoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/Format2DummyClassEncoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/Format2DummyClassNocoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassDecoder.php (100%) rename tests/{testing_environment => fixtures}/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassEncoder.php (100%) rename tests/{testing_environment => fixtures}/data/decoded/.gitignore (100%) rename tests/{testing_environment => fixtures}/data/decoded/json.php (100%) rename tests/{testing_environment => fixtures}/data/decoded/yaml.php (100%) rename tests/{testing_environment => fixtures}/data/encoded/.gitignore (100%) rename tests/{testing_environment => fixtures}/data/encoded/data (100%) rename tests/{testing_environment => fixtures}/data/encoded/data.anotherformat (100%) rename tests/{testing_environment => fixtures}/data/encoded/data.format (100%) rename tests/{testing_environment => fixtures}/data/encoded/data.json (100%) rename tests/{testing_environment => fixtures}/data/encoded/data.nonexistentformat (100%) rename tests/{testing_environment => fixtures}/data/encoded/data.yaml (100%) rename tests/{testing_environment => fixtures}/files/directory/file-for-read (100%) rename tests/{testing_environment => fixtures}/files/directory/file-for-write (100%) rename tests/{testing_environment => fixtures}/files/file-for-read (100%) rename tests/{testing_environment => fixtures}/files/file-for-read.dat (100%) rename tests/{testing_environment => fixtures}/files/file-for-read.ext (100%) rename tests/{testing_environment => fixtures}/files/file-for-write (100%) rename tests/{testing_environment => fixtures}/files/file-for-write.dat (100%) rename tests/{testing_environment => fixtures}/files/file-for-write.ext (100%) rename tests/{testing_environment => fixtures}/files/self-test (100%) rename tests/{testing_environment => fixtures}/files/unreadable-directory/file-for-read (100%) rename tests/{testing_environment => fixtures}/files/unreadable-file (100%) rename tests/{testing_environment => fixtures}/files/unwritable-directory/file-for-write (100%) rename tests/{testing_environment => fixtures}/files/unwritable-file (100%) delete mode 100644 tests/testing_environment/data/created/.gitignore diff --git a/composer.json b/composer.json index 23e4d3b..1f48453 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "psr-4": { "ExOrg\\DataCoder\\": [ "tests/unit_tests/", - "tests/testing_environment/classes/" + "tests/fixtures/classes/" ] } }, diff --git a/tests/testing_environment/classes/Coder/Format/Data/Decoder.php b/tests/fixtures/classes/Coder/Format/Data/Decoder.php similarity index 100% rename from tests/testing_environment/classes/Coder/Format/Data/Decoder.php rename to tests/fixtures/classes/Coder/Format/Data/Decoder.php diff --git a/tests/testing_environment/classes/Coder/Format/Data/Encoder.php b/tests/fixtures/classes/Coder/Format/Data/Encoder.php similarity index 100% rename from tests/testing_environment/classes/Coder/Format/Data/Encoder.php rename to tests/fixtures/classes/Coder/Format/Data/Encoder.php diff --git a/tests/testing_environment/classes/Coder/Format1/Data/Decoder.php b/tests/fixtures/classes/Coder/Format1/Data/Decoder.php similarity index 100% rename from tests/testing_environment/classes/Coder/Format1/Data/Decoder.php rename to tests/fixtures/classes/Coder/Format1/Data/Decoder.php diff --git a/tests/testing_environment/classes/Coder/Format1/Data/Encoder.php b/tests/fixtures/classes/Coder/Format1/Data/Encoder.php similarity index 100% rename from tests/testing_environment/classes/Coder/Format1/Data/Encoder.php rename to tests/fixtures/classes/Coder/Format1/Data/Encoder.php diff --git a/tests/testing_environment/classes/Coder/Format2/Data/Decoder.php b/tests/fixtures/classes/Coder/Format2/Data/Decoder.php similarity index 100% rename from tests/testing_environment/classes/Coder/Format2/Data/Decoder.php rename to tests/fixtures/classes/Coder/Format2/Data/Decoder.php diff --git a/tests/testing_environment/classes/Coder/Format2/Data/Encoder.php b/tests/fixtures/classes/Coder/Format2/Data/Encoder.php similarity index 100% rename from tests/testing_environment/classes/Coder/Format2/Data/Encoder.php rename to tests/fixtures/classes/Coder/Format2/Data/Encoder.php diff --git a/tests/testing_environment/classes/Coder/Format3/Data/Decoder.php b/tests/fixtures/classes/Coder/Format3/Data/Decoder.php similarity index 100% rename from tests/testing_environment/classes/Coder/Format3/Data/Decoder.php rename to tests/fixtures/classes/Coder/Format3/Data/Decoder.php diff --git a/tests/testing_environment/classes/Coder/Format3/Data/Encoder.php b/tests/fixtures/classes/Coder/Format3/Data/Encoder.php similarity index 100% rename from tests/testing_environment/classes/Coder/Format3/Data/Encoder.php rename to tests/fixtures/classes/Coder/Format3/Data/Encoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat1Decoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormat1Decoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat1Decoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormat1Decoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat1Encoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormat1Encoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat1Encoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormat1Encoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat1Nocoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormat1Nocoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat1Nocoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormat1Nocoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat2Decoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormat2Decoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat2Decoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormat2Decoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat2Encoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormat2Encoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat2Encoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormat2Encoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat2Nocoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormat2Nocoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormat2Nocoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormat2Nocoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedDecoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedDecoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedDecoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedDecoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedEncoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedEncoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedEncoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormatNotRecognizedEncoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNullDecoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormatNullDecoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNullDecoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormatNullDecoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNullEncoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormatNullEncoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/DummyClassFormatNullEncoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/DummyClassFormatNullEncoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/Format1DummyClassDecoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/Format1DummyClassDecoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/Format1DummyClassDecoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/Format1DummyClassDecoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/Format1DummyClassEncoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/Format1DummyClassEncoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/Format1DummyClassEncoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/Format1DummyClassEncoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/Format1DummyClassNocoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/Format1DummyClassNocoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/Format1DummyClassNocoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/Format1DummyClassNocoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/Format2DummyClassDecoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/Format2DummyClassDecoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/Format2DummyClassDecoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/Format2DummyClassDecoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/Format2DummyClassEncoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/Format2DummyClassEncoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/Format2DummyClassEncoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/Format2DummyClassEncoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/Format2DummyClassNocoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/Format2DummyClassNocoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/Format2DummyClassNocoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/Format2DummyClassNocoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassDecoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassDecoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassDecoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassDecoder.php diff --git a/tests/testing_environment/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassEncoder.php b/tests/fixtures/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassEncoder.php similarity index 100% rename from tests/testing_environment/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassEncoder.php rename to tests/fixtures/classes/CoderBuildingTraitUsing/FormatnotrecognizedDummyClassEncoder.php diff --git a/tests/testing_environment/data/decoded/.gitignore b/tests/fixtures/data/decoded/.gitignore similarity index 100% rename from tests/testing_environment/data/decoded/.gitignore rename to tests/fixtures/data/decoded/.gitignore diff --git a/tests/testing_environment/data/decoded/json.php b/tests/fixtures/data/decoded/json.php similarity index 100% rename from tests/testing_environment/data/decoded/json.php rename to tests/fixtures/data/decoded/json.php diff --git a/tests/testing_environment/data/decoded/yaml.php b/tests/fixtures/data/decoded/yaml.php similarity index 100% rename from tests/testing_environment/data/decoded/yaml.php rename to tests/fixtures/data/decoded/yaml.php diff --git a/tests/testing_environment/data/encoded/.gitignore b/tests/fixtures/data/encoded/.gitignore similarity index 100% rename from tests/testing_environment/data/encoded/.gitignore rename to tests/fixtures/data/encoded/.gitignore diff --git a/tests/testing_environment/data/encoded/data b/tests/fixtures/data/encoded/data similarity index 100% rename from tests/testing_environment/data/encoded/data rename to tests/fixtures/data/encoded/data diff --git a/tests/testing_environment/data/encoded/data.anotherformat b/tests/fixtures/data/encoded/data.anotherformat similarity index 100% rename from tests/testing_environment/data/encoded/data.anotherformat rename to tests/fixtures/data/encoded/data.anotherformat diff --git a/tests/testing_environment/data/encoded/data.format b/tests/fixtures/data/encoded/data.format similarity index 100% rename from tests/testing_environment/data/encoded/data.format rename to tests/fixtures/data/encoded/data.format diff --git a/tests/testing_environment/data/encoded/data.json b/tests/fixtures/data/encoded/data.json similarity index 100% rename from tests/testing_environment/data/encoded/data.json rename to tests/fixtures/data/encoded/data.json diff --git a/tests/testing_environment/data/encoded/data.nonexistentformat b/tests/fixtures/data/encoded/data.nonexistentformat similarity index 100% rename from tests/testing_environment/data/encoded/data.nonexistentformat rename to tests/fixtures/data/encoded/data.nonexistentformat diff --git a/tests/testing_environment/data/encoded/data.yaml b/tests/fixtures/data/encoded/data.yaml similarity index 100% rename from tests/testing_environment/data/encoded/data.yaml rename to tests/fixtures/data/encoded/data.yaml diff --git a/tests/testing_environment/files/directory/file-for-read b/tests/fixtures/files/directory/file-for-read similarity index 100% rename from tests/testing_environment/files/directory/file-for-read rename to tests/fixtures/files/directory/file-for-read diff --git a/tests/testing_environment/files/directory/file-for-write b/tests/fixtures/files/directory/file-for-write similarity index 100% rename from tests/testing_environment/files/directory/file-for-write rename to tests/fixtures/files/directory/file-for-write diff --git a/tests/testing_environment/files/file-for-read b/tests/fixtures/files/file-for-read similarity index 100% rename from tests/testing_environment/files/file-for-read rename to tests/fixtures/files/file-for-read diff --git a/tests/testing_environment/files/file-for-read.dat b/tests/fixtures/files/file-for-read.dat similarity index 100% rename from tests/testing_environment/files/file-for-read.dat rename to tests/fixtures/files/file-for-read.dat diff --git a/tests/testing_environment/files/file-for-read.ext b/tests/fixtures/files/file-for-read.ext similarity index 100% rename from tests/testing_environment/files/file-for-read.ext rename to tests/fixtures/files/file-for-read.ext diff --git a/tests/testing_environment/files/file-for-write b/tests/fixtures/files/file-for-write similarity index 100% rename from tests/testing_environment/files/file-for-write rename to tests/fixtures/files/file-for-write diff --git a/tests/testing_environment/files/file-for-write.dat b/tests/fixtures/files/file-for-write.dat similarity index 100% rename from tests/testing_environment/files/file-for-write.dat rename to tests/fixtures/files/file-for-write.dat diff --git a/tests/testing_environment/files/file-for-write.ext b/tests/fixtures/files/file-for-write.ext similarity index 100% rename from tests/testing_environment/files/file-for-write.ext rename to tests/fixtures/files/file-for-write.ext diff --git a/tests/testing_environment/files/self-test b/tests/fixtures/files/self-test similarity index 100% rename from tests/testing_environment/files/self-test rename to tests/fixtures/files/self-test diff --git a/tests/testing_environment/files/unreadable-directory/file-for-read b/tests/fixtures/files/unreadable-directory/file-for-read similarity index 100% rename from tests/testing_environment/files/unreadable-directory/file-for-read rename to tests/fixtures/files/unreadable-directory/file-for-read diff --git a/tests/testing_environment/files/unreadable-file b/tests/fixtures/files/unreadable-file similarity index 100% rename from tests/testing_environment/files/unreadable-file rename to tests/fixtures/files/unreadable-file diff --git a/tests/testing_environment/files/unwritable-directory/file-for-write b/tests/fixtures/files/unwritable-directory/file-for-write similarity index 100% rename from tests/testing_environment/files/unwritable-directory/file-for-write rename to tests/fixtures/files/unwritable-directory/file-for-write diff --git a/tests/testing_environment/files/unwritable-file b/tests/fixtures/files/unwritable-file similarity index 100% rename from tests/testing_environment/files/unwritable-file rename to tests/fixtures/files/unwritable-file diff --git a/tests/testing_environment/data/created/.gitignore b/tests/testing_environment/data/created/.gitignore deleted file mode 100644 index 22e8364..0000000 --- a/tests/testing_environment/data/created/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/* \ No newline at end of file diff --git a/tests/unit_tests/File/FileTest.php b/tests/unit_tests/File/FileTest.php index 5bc3faa..74465c2 100644 --- a/tests/unit_tests/File/FileTest.php +++ b/tests/unit_tests/File/FileTest.php @@ -29,7 +29,7 @@ class FileTest extends TestCase * Relative path of directory with file fixtures * used in tests. */ - const FILE_FIXTURES_RELATIVE_PATH = '../../testing_environment/files'; + const FILE_FIXTURES_RELATIVE_PATH = '../../fixtures/files'; const FILE_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\File\File'; const FILE_EXCEPTION_FULLY_QUALIFIED_CLASS_NAME = 'ExOrg\DataCoder\File\FileException'; diff --git a/tests/unit_tests/Fixture/DataFileFixturesHelper.php b/tests/unit_tests/Fixture/DataFileFixturesHelper.php index e6e8a73..59f2b63 100644 --- a/tests/unit_tests/Fixture/DataFileFixturesHelper.php +++ b/tests/unit_tests/Fixture/DataFileFixturesHelper.php @@ -29,7 +29,7 @@ class DataFileFixturesHelper * They are inputs and the expected results * of the encoding/decoding operations. */ - const FILES_DIRECTORY = '../../testing_environment/data'; + const FILES_DIRECTORY = '../../fixtures/data'; /** * Directory with the files containing encoded data diff --git a/tests/unit_tests/Fixture/DataFileFixturesHelperTest.php b/tests/unit_tests/Fixture/DataFileFixturesHelperTest.php index f3b8162..3c5cc57 100644 --- a/tests/unit_tests/Fixture/DataFileFixturesHelperTest.php +++ b/tests/unit_tests/Fixture/DataFileFixturesHelperTest.php @@ -34,7 +34,7 @@ class DataFileFixturesHelperTest extends TestCase * They are inputs and the expected results * of the encoding/decoding operations. */ - const FILES_DIRECTORY = '../../testing_environment/data'; + const FILES_DIRECTORY = '../../fixtures/data'; /** * Instance of tested class. From eb2ac46fc2cbb3b23febb61f27a16a6e22c7f620 Mon Sep 17 00:00:00 2001 From: katheroine Date: Mon, 20 Nov 2023 20:23:14 +0100 Subject: [PATCH 22/26] README updated (ExOrg#107) --- README.md | 110 +++++++++++++++++++++--------------------------------- 1 file changed, 43 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index f35acad..354d158 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,37 @@ # DataCoder -[![Build Status](https://travis-ci.org/ExOrg/php-data-coder.svg?branch=master)](https://travis-ci.org/ExOrg/php-data-coder) +![example workflow](https://github.com/ExOrg/php-data-coder/actions/workflows/php.yml/badge.svg) -Extendable set of data and datafile encoders and decoders. It allows to transfer PHP arrays into data strings and datafiles and vice versa with chosen format like YAML and JSON. It provides encapsulation of various decoding and encoding mechanisms, unifies interface and exceptions handling. +Extendable set of data and data file encoders and decoders. It allows to transfer PHP arrays into data strings and datafiles and vice versa with chosen format like YAML and JSON. It provides encapsulation of various decoding and encoding mechanisms, unifies interface and exceptions handling. There are various groups of decoders and encoders -* With predefined data format - e.g. *JsonDataDecoder*, *YamlDatafileEncoder* -* With configurable data format - e.g. *DataDecoder*, *DatafileEncoder* -* For raw data - e.g. *JsonDataDecoder*, *DataEncoder* -* For data in the file - e.g. *YamlDatafileEncoder*, *DatafileDecoder* +* With predefined data format - e.g. *Coder\Json\Data\Decoder*, *Coder\Yaml\Datafile\Encoder* +* With configurable data format - e.g. *Coder\Data\Decoder*, *Coder\Datafile\Encoder* +* For raw data - e.g. *Coder\Json\Data\Decoder*, *Coder\Data\Encoder* +* For data in the file - e.g. *Coder\Yaml\Datafile\Encoder*, *Coder\Datafile\Decoder* ## Getting Started ### Prerequisities -* PHP 8.0+ -* [Composer](https://getcomposer.org/) 2.5.0+ +* [PHP](https://www.php.net/) 8.1 - 8.3 +* [Git](https://git-scm.com/) 2.25.1+ +* [Composer](https://getcomposer.org/) 2.6.0+ -### Installation +The instruction assumes using the Linux operating system or compatible tools for other operating systems. -The recommended way to install DataCoder into the source code of the project is to handle it as code dependency by [Composer](http://getcomposer.org). +### Installation -#### cURL, php8.0-cli and Git +#### php8.*-cli, Git and Composer required -The command line tool cURL will be used to to download *Composer* installer and *php8.0-cli* for and running it to install Composer. Git is needed by to downloading dependencies by the Composer. +The recommended way to install DataCoder into the source code of the project is to handle it as code dependency by [Composer](http://getcomposer.org). [Git](https://git-scm.com/) is needed to fetch packages from version control repositories. -#### Composer +The *php8.\*-cli* is needed for installing Composer. -The common way to intall Composer is downloading installer via *curl* tool and call the PHP interpreter to run it. +#### DataCoder installation -```bash -curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer -``` -Now composer is available as the command line tool and can be run by typing `composer` with appropriate parameters. - -#### DataCoder - -Add to your **composer.json** file following entry in the *require* section -``` -{ - "require": { - "exorg/data-coder": "^1.0.0" - } -} -``` -You can do it manually or by running the following command +Add to your **composer.json** file appropriate entry by running the following command ```bash composer require exorg/data-coder ``` @@ -53,7 +39,6 @@ If it's project set-up stage and no one dependency have been installed yet, run ```bash composer install ``` - If another dependencies have been intalled previously, run ```bash composer update @@ -65,14 +50,12 @@ The simplest way to autoload all needed files in executable file is attaching *a ```php require_once (__DIR__ . '/vendor/autoload.php'); - ``` ### Data Encoders with predefined format ```php - -use ExOrg\DataCoder\JsonDataEncoder; +use ExOrg\DataCoder\Coder\Json\Data\Encoder; $data = [ "firstName" => "John", @@ -85,7 +68,7 @@ $data = [ ], ]; -$encoder = new JsonDataEncoder(); +$encoder = new Encoder(); $result = $encoder->encodeData($data); print($result); @@ -107,11 +90,9 @@ print($result); ### Data Decoders with predefined format ```php - -use ExOrg\DataCoder\YamlDataDecoder; +use ExOrg\DataCoder\Coder\Yaml\Data\Decoder; $data = ' ---- firstName: John lastName: Smith address: @@ -119,10 +100,9 @@ address: city: New York state: NY postalCode: 10021-3100 -... '; -$decoder = new YamlDataDecoder(); +$decoder = new Decoder(); $result = $decoder->decodeData($data); print_r($result); @@ -147,7 +127,7 @@ Array ### Data Encoder with configurable format ```php -use ExOrg\DataCoder\DataEncoder; +use ExOrg\DataCoder\Coder\Data\Encoder; $data = [ "firstName" => "John", @@ -160,7 +140,7 @@ $data = [ ], ]; -$encoder = new DataEncoder(); +$encoder = new Encoder(); $encoder->setDataFormat('yaml'); $result = $encoder->encodeData($data); @@ -168,22 +148,20 @@ print($result); ``` --- ``` ---- firstName: John lastName: Smith address: - streetAddress: 21 2nd Street - city: New York - state: NY - postalCode: 10021-3100 -... + streetAddress: '21 2nd Street' + city: 'New York' + state: NY + postalCode: 10021-3100 ``` ### Data Decoder with configurable format ```php -use ExOrg\DataCoder\DataDecoder; +use ExOrg\DataCoder\Coder\Data\Decoder; $data = ' { @@ -199,7 +177,7 @@ $data = ' } '; -$decoder = new DataDecoder(); +$decoder = new Decoder(); $decoder->setDataFormat('json'); $result = $decoder->decodeData($data); @@ -225,16 +203,16 @@ Array ### Datafile Encoders and Decoders -Datafile Encoders and Decoders usage is similar to the Data Encoders and Decoders. There are coders with predefined data format like **JsonDatafileEncoder** or **YamlDatafileDecoder** and those, where data format can be chosen by function *setDataFormat*, just like in examples above - **DatafileEncoder** and **DatafileDecoder**. +Datafile Encoders and Decoders usage is similar to the Data Encoders and Decoders. There are coders with predefined data format like **Coder\Json\Datafile\Encoder** or **Coder\Yaml\Datafile\Decoder** and those, where data format can be chosen by function *setDataFormat*, just like in examples above - **Code\Datafile\Encoder** and **Code\Datafile\Decoder**. #### Data format recognizing by file extension -Datafile coders with configurable data format - **DatafileEncoder** and **DatafileDecoder** - can recognize data format by file extension. In that case, there is no need to set data format manually. +Datafile coders with configurable data format - **Coder\Datafile\Encoder** and **Coder\Datafile\Decoder** - can recognize data format by file extension. In that case, there is no need to set data format manually. -##### DatafileEncoder +##### Datafile Encoder ```php -use ExOrg\DataCoder\DatafileEncoder; +use ExOrg\DataCoder\Coder\Datafile\Encoder; $data = [ "firstName" => "John", @@ -249,7 +227,7 @@ $data = [ $datafilePath = 'data.json'; -$encoder = new DatafileEncoder(); +$encoder = new Encoder(); $encoder->encodeFile($data, $datafilePath); print file_get_contents($datafilePath); @@ -268,31 +246,29 @@ print file_get_contents($datafilePath); } ``` -##### DatafileDecoder +##### Datafile Decoder ```php -use ExOrg\DataCoder\DatafileDecoder; +use ExOrg\DataCoder\Coder\Datafile\Decoder; $datafilePath = 'data.yaml'; print file_get_contents($datafilePath); -$decoder = new DatafileDecoder(); +$decoder = new Decoder(); $data = $decoder->decodeFile($datafilePath); print_r($data); ``` --- ``` ---- firstName: John lastName: Smith address: - streetAddress: 21 2nd Street - city: New York - state: NY - postalCode: 10021-3100 -... + streetAddress: '21 2nd Street' + city: 'New York' + state: NY + postalCode: 10021-3100 Array ( [firstName] => John @@ -328,7 +304,7 @@ composer test ### Code style tests -This code follows [PSR-1](http://www.php-fig.org/psr/psr-1/) and [PSR-2](http://www.php-fig.org/psr/psr-2/) standards. +This code follows [PSR-1](http://www.php-fig.org/psr/psr-1/) and [PSR-12](http://www.php-fig.org/psr/psr-12/) standards. To run tests for code style write the following command in your command line inside the main DataCoder project directory @@ -355,13 +331,13 @@ composer check * [Remarkable](https://remarkableapp.github.io/) * [PHPUnit](https://phpunit.de/) * [PHPCodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) +* [Composer](https://getcomposer.org/) * [Git](https://git-scm.com/) * [GitHub](https://github.com/) -* [Travis](https://travis-ci.com/) ## Versioning -This project is versioning according to [SemVer](http://semver.org/) versioning standars. All available [releases](https://github.com/ExOrg/php-data-coder/releases) are [tagged](https://github.com/ExOrg/php-data-coder/tags). +This project is versioning according to [SemVer](http://semver.org/) versioning standars. All available [releases](https://github.com/ExOrg/php-data-coder/releases) are [tagged](https://github.com/ExOrg/php-data-coder/tags). ## Contributing From a27bdb879125b09a067709f60d495389e873e96b Mon Sep 17 00:00:00 2001 From: katheroine Date: Wed, 22 Nov 2023 16:22:56 +0100 Subject: [PATCH 23/26] PHPCodeSniffer excluding comment added to DataFormat enum (ExOrg#107) --- src/DataFormat/DataFormat.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/DataFormat/DataFormat.php b/src/DataFormat/DataFormat.php index 2b8dac5..e0d93c9 100644 --- a/src/DataFormat/DataFormat.php +++ b/src/DataFormat/DataFormat.php @@ -25,7 +25,9 @@ */ class DataFormat extends Enum { + // phpcs:disable const __default = self::JSON; + // phpcs:disable const JSON = "JSON"; const YAML = "YAML"; From 36af9630790b94b4634aede033e519f63bc22cb1 Mon Sep 17 00:00:00 2001 From: katheroine Date: Wed, 22 Nov 2023 18:53:22 +0100 Subject: [PATCH 24/26] Class names in PHPDoc updated (ExOrg#107) --- src/Coder/Json/Datafile/Decoder.php | 2 +- src/Coder/Yaml/Datafile/Encoder.php | 2 +- tests/fixtures/classes/Coder/Format/Data/Decoder.php | 2 +- tests/fixtures/classes/Coder/Format/Data/Encoder.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Coder/Json/Datafile/Decoder.php b/src/Coder/Json/Datafile/Decoder.php index a41988e..7b79d57 100644 --- a/src/Coder/Json/Datafile/Decoder.php +++ b/src/Coder/Json/Datafile/Decoder.php @@ -15,7 +15,7 @@ use ExOrg\DataCoder\Coder\Json\Data\Decoder as DataDecoder; /** - * JsonDatafileDecoder. + * Json Datafile Decoder. * Datafile decoder for JSON format. * * @package DataCoder diff --git a/src/Coder/Yaml/Datafile/Encoder.php b/src/Coder/Yaml/Datafile/Encoder.php index d3f4862..8806c27 100644 --- a/src/Coder/Yaml/Datafile/Encoder.php +++ b/src/Coder/Yaml/Datafile/Encoder.php @@ -15,7 +15,7 @@ use ExOrg\DataCoder\Coder\Yaml\Data\Encoder as DataEncoder; /** - * YamlDatafileEncoder. + * Yaml Datafile Encoder. * Datafile encoder for YAML format. * * @package DataCoder diff --git a/tests/fixtures/classes/Coder/Format/Data/Decoder.php b/tests/fixtures/classes/Coder/Format/Data/Decoder.php index 8f5f44f..b0d5eeb 100644 --- a/tests/fixtures/classes/Coder/Format/Data/Decoder.php +++ b/tests/fixtures/classes/Coder/Format/Data/Decoder.php @@ -12,7 +12,7 @@ namespace ExOrg\DataCoder\Coder\Format\Data; /** - * FormatDataDecoder. + * Format Data Decoder. * Dummy data decoder for testing purposes only. * * @package DataCoder diff --git a/tests/fixtures/classes/Coder/Format/Data/Encoder.php b/tests/fixtures/classes/Coder/Format/Data/Encoder.php index 6bb3ce1..69baae8 100644 --- a/tests/fixtures/classes/Coder/Format/Data/Encoder.php +++ b/tests/fixtures/classes/Coder/Format/Data/Encoder.php @@ -12,7 +12,7 @@ namespace ExOrg\DataCoder\Coder\Format\Data; /** - * FormatDataEncoder. + * Format Data Encoder. * Dummy data encoder for testing purposes only. * * @package DataCoder From 67291a44581be2b3c0a81786310b767497255ae9 Mon Sep 17 00:00:00 2001 From: katheroine Date: Thu, 23 Nov 2023 13:53:16 +0100 Subject: [PATCH 25/26] Class descriptions in PHPDoc updated (ExOrg#107) --- tests/unit_tests/DataFormat/DataFormatTest.php | 2 +- tests/unit_tests/File/FileExceptionTest.php | 2 +- tests/unit_tests/File/FileTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit_tests/DataFormat/DataFormatTest.php b/tests/unit_tests/DataFormat/DataFormatTest.php index 20c6665..b18e639 100644 --- a/tests/unit_tests/DataFormat/DataFormatTest.php +++ b/tests/unit_tests/DataFormat/DataFormatTest.php @@ -14,7 +14,7 @@ use PHPUnit\Framework\TestCase; /** - * DataFormatTest. + * DataFormat Test. * PHPUnit test class for DataFormat class. * * @package DataCoder diff --git a/tests/unit_tests/File/FileExceptionTest.php b/tests/unit_tests/File/FileExceptionTest.php index 41f045a..b88d777 100644 --- a/tests/unit_tests/File/FileExceptionTest.php +++ b/tests/unit_tests/File/FileExceptionTest.php @@ -14,7 +14,7 @@ use PHPUnit\Framework\TestCase; /** - * FileExceptionTest. + * FileException Test. * PHPUnit test class for FileException class. * * @package DataCoder diff --git a/tests/unit_tests/File/FileTest.php b/tests/unit_tests/File/FileTest.php index 74465c2..961f5ed 100644 --- a/tests/unit_tests/File/FileTest.php +++ b/tests/unit_tests/File/FileTest.php @@ -14,7 +14,7 @@ use PHPUnit\Framework\TestCase; /** - * FileTest. + * File Test. * PHPUnit test class for File class. * * @package DataCoder From f8c7ed6b8ce47f8d4f1c8a4c7428ef3e458edce0 Mon Sep 17 00:00:00 2001 From: katheroine Date: Thu, 23 Nov 2023 13:54:09 +0100 Subject: [PATCH 26/26] .gitignore files in fixtures directories updated (ExOrg#107) --- tests/fixtures/data/decoded/.gitignore | 1 - tests/fixtures/data/encoded/.gitignore | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/fixtures/data/decoded/.gitignore b/tests/fixtures/data/decoded/.gitignore index 594d698..e74254c 100644 --- a/tests/fixtures/data/decoded/.gitignore +++ b/tests/fixtures/data/decoded/.gitignore @@ -1,2 +1 @@ self-test.php - diff --git a/tests/fixtures/data/encoded/.gitignore b/tests/fixtures/data/encoded/.gitignore index 0eea5b8..66e4f09 100644 --- a/tests/fixtures/data/encoded/.gitignore +++ b/tests/fixtures/data/encoded/.gitignore @@ -1,2 +1 @@ data.self-test -