diff options
Diffstat (limited to 'tests/mocks')
-rw-r--r-- | tests/mocks/MockCompiler.php | 34 | ||||
-rw-r--r-- | tests/mocks/MockLoader.php | 32 | ||||
-rw-r--r-- | tests/mocks/MockParser.php | 28 |
3 files changed, 94 insertions, 0 deletions
diff --git a/tests/mocks/MockCompiler.php b/tests/mocks/MockCompiler.php new file mode 100644 index 0000000..89db68f --- /dev/null +++ b/tests/mocks/MockCompiler.php @@ -0,0 +1,34 @@ +<?php +declare(strict_types=1); + +/** + * @author: Alexander Kiryukhin <alexander@kiryukhin.su> + * @license: MIT + */ + +use NeonXP\Dotenv\Compiler\CompilerInterface; +use NeonXP\Dotenv\Types\KeyValue; + +/** + * Class MockCompiler + */ +class MockCompiler implements CompilerInterface +{ + + /** + * @param KeyValue[] $collection + */ + function setRawCollection(array $collection): void + { + // Do nothing + } + + /** + * @param KeyValue $keyValue + * @return KeyValue + */ + function compileKeyValue(KeyValue $keyValue): KeyValue + { + return $keyValue; + } +}
\ No newline at end of file diff --git a/tests/mocks/MockLoader.php b/tests/mocks/MockLoader.php new file mode 100644 index 0000000..bb0d557 --- /dev/null +++ b/tests/mocks/MockLoader.php @@ -0,0 +1,32 @@ +<?php +declare(strict_types=1); + +/** + * @author: Alexander Kiryukhin <alexander@kiryukhin.su> + * @license: MIT + */ + +use NeonXP\Dotenv\Loader\LoaderInterface; + +/** + * Class MockLoader + */ +class MockLoader implements LoaderInterface +{ + + /** + * Load not empty lines from file or other source + * @param string $filePath + * @return string[] + */ + public function load(string $filePath = '.env'): array + { + return [ + 'KEY1=VALUE1', + 'KEY2=VALUE2', + 'KEY3=VALUE3', + 'KEY4=VALUE4', + 'KEY5=VALUE5', + ]; + } +}
\ No newline at end of file diff --git a/tests/mocks/MockParser.php b/tests/mocks/MockParser.php new file mode 100644 index 0000000..39c369c --- /dev/null +++ b/tests/mocks/MockParser.php @@ -0,0 +1,28 @@ +<?php +declare(strict_types=1); + +/** + * @author: Alexander Kiryukhin <alexander@kiryukhin.su> + * @license: MIT + */ + +use NeonXP\Dotenv\Parser\ParserInterface; +use NeonXP\Dotenv\Types\KeyValue; + +/** + * Class MockParser + */ +class MockParser implements ParserInterface +{ + + /** + * @param string $line + * @return KeyValue + */ + public function parseLine(string $line): KeyValue + { + list($key, $value) = explode("=", $line); + + return new KeyValue($key, $value); + } +}
\ No newline at end of file |