Initial commit

This commit is contained in:
Daniel Seifert 2022-11-11 11:30:45 +01:00 gecommit door Daniel Seifert
commit 4e13a0b79a
Getekend door: DanielS
GPG sleutel-ID: 8A7C4C6ED1915C6F
8 gewijzigde bestanden met toevoegingen van 245 en 0 verwijderingen

13
.php-cs-fixer.php Normal file
Bestand weergeven

@ -0,0 +1,13 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
;
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PHP73Migration' => true,
'@PSR12' => true
])
->setFinder($finder)
;

11
CHANGELOG.md Normal file
Bestand weergeven

@ -0,0 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased](https://git.d3data.de/D3Public/TestingTools/compare/1.0.0.0...rel_1.x)
## [1.0.0.0](https://git.d3data.de/D3Public/TestingTools/releases/tag/1.0.0.0) - 2022-11-11
### Added
- implemented features

21
LICENSE.md Normal file
Bestand weergeven

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 D3 Data Development (Inh. Thomas Dartsch)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

65
README.en.md Normal file
Bestand weergeven

@ -0,0 +1,65 @@
[![deutsche Version](https://logos.oxidmodule.com/de2_xs.svg)](README.md)
[![english version](https://logos.oxidmodule.com/en2_xs.svg)](README.en.md)
# Tools for better testable code
This package provides tools to circumvent difficulties when testing plug-in code from customisable frameworks (e.g. shop software).
- Method bundles can be included as traits depending on the class.
- contains methods for the production code and prepared methods for own tests to validate the production code
- `Production\IsMockable`: contains methods for mocking parent calls
- `Development\IsMockable`: contains test code for `Production\IsMockable`.
- `Development\IsTestable`: contains methods for better accessibility of protected code
## Table of content
- [Installation](#installation)
- [How to use](#how-to-use)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [License](#license)
- [Further licences and terms of use](#further-licences-and-terms-of-use)
## Installation
This package requires a project installed with Composer.
Open a command line and navigate to the root directory of the installation. Execute the following command. Adapt the path details to your installation environment.
```bash
php composer require d3/testingtools:^1.0
```
## How to use
Include the respective trait in your class and use the desired method in your code:
```
use \D3\TestingTools\Production\IsMockable;
```
## Changelog
See [CHANGELOG](CHANGELOG.md) for further informations.
## Contributing
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue. Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (git checkout -b feature/AmazingFeature)
- Commit your Changes (git commit -m 'Add some AmazingFeature')
- Push to the Branch (git push origin feature/AmazingFeature)
- Open a Pull Request
## License
(status: 2022-11-11)
Distributed under the MIT license.
```
Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
```
For full copyright and licensing information, please see the [LICENSE](LICENSE.md) file distributed with this source code.

66
README.md Normal file
Bestand weergeven

@ -0,0 +1,66 @@
[![deutsche Version](https://logos.oxidmodule.com/de2_xs.svg)](README.md)
[![english version](https://logos.oxidmodule.com/en2_xs.svg)](README.en.md)
# Hilfstools für besser testbaren Code
Dieses Paket stellt Hilfstools bereit, um Schwierigkeiten beim Testen von Plugincode aus frei erweiterbaren Frameworks (z.B. Shopsoftware) zu umgehen.
- Methodenbundles lassen sich als Trait klassenabhängig einbinden
- enthält Methoden für den Produktivcode und vorbereitete Methoden für eigene Tests, um den Produktivcode zu validieren
- `Production\IsMockable`: enthält Methoden zum Mocken von Parentaufrufen
- `Development\IsMockable`: enthält Testcode für `Production\IsMockable`
- `Development\IsTestable`: enthält Methoden für bessere Zugänglichkeit von protected Code
## Inhaltsverzeichnis
- [Installation](#installation)
- [Verwendung](#verwendung)
- [Changelog](#changelog)
- [Beitragen](#beitragen)
- [Lizenz](#lizenz)
- [weitere Lizenzen und Nutzungsbedingungen](#weitere-lizenzen-und-nutzungsbedingungen)
## Installation
Dieses Paket erfordert ein mit Composer installiertes Projekt.
Öffnen Sie eine Kommandozeile und navigieren Sie zum Stammverzeichnis Ihrer Installation. Führen Sie den folgenden Befehl aus. Passen Sie die Pfadangaben an Ihre Installationsumgebung an.
```bash
php composer require d3/d3/testingtools:^1.0
```
## Verwendung
Binden Sie den jeweiligen Trait in Ihre Klasse ein und verwenden die gewünschte Methode in Ihrem Code:
```
use \D3\TestingTools\Production\IsMockable;
```
## Changelog
Siehe [CHANGELOG](CHANGELOG.md) für weitere Informationen.
## Beitragen
Wenn Sie eine Verbesserungsvorschlag haben, legen Sie einen Fork des Repositories an und erstellen Sie einen Pull Request. Alternativ können Sie einfach ein Issue erstellen. Fügen Sie das Projekt zu Ihren Favoriten hinzu. Vielen Dank.
- Erstellen Sie einen Fork des Projekts
- Erstellen Sie einen Feature Branch (git checkout -b feature/AmazingFeature)
- Fügen Sie Ihre Änderungen hinzu (git commit -m 'Add some AmazingFeature')
- Übertragen Sie den Branch (git push origin feature/AmazingFeature)
- Öffnen Sie einen Pull Request
## Lizenz
(Stand: 11.11.2022)
Vertrieben unter der MIT Lizenz.
```
Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
```
Die vollständigen Copyright- und Lizenzinformationen entnehmen Sie bitte der [LICENSE](LICENSE.md)-Datei, die mit diesem Quellcode verteilt wurde.

39
composer.json Normal file
Bestand weergeven

@ -0,0 +1,39 @@
{
"name": "d3/testingtools",
"type": "library",
"description": "some tools to improve code tests",
"keywords": [
"PHP Unit",
"Tests",
"tools"
],
"homepage": "https://d3data.de/",
"authors": [
{
"name": "D3 Data Development (Inh. Thomas Dartsch)",
"email": "info@shopmodule.com",
"homepage": "https://www.d3data.de",
"role": "Owner"
}
],
"support": {
"email": "support@shopmodule.com"
},
"license": [
"MIT"
],
"require": {
"php": "^7 || ^8"
},
"require-dev": {
"phpunit/phpunit" : "^9.5",
"friendsofphp/php-cs-fixer": "^3.9",
"phpstan/phpstan": "^1.8"
},
"autoload": {
"psr-4": {
"D3\\TestingTools\\": "src",
"D3\\TestingTools\\Tests\\": "Tests"
}
}
}

10
phpstan.neon Normal file
Bestand weergeven

@ -0,0 +1,10 @@
parameters:
scanFiles:
- IntelliSenseHelper.php
- ../../oxid-esales/oxideshop-ce/source/oxfunctions.php
- ../../oxid-esales/oxideshop-ce/source/overridablefunctions.php
level: 9
phpVersion: 70100
checkMissingIterableValueType: false
ignoreErrors:
- '#Psr\\Container\\ContainerExceptionInterface is not subtype of Throwable#'

20
phpunit.xml Normal file
Bestand weergeven

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
<report>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<testsuite name="myModule">
<directory>./Tests</directory>
</testsuite>
<logging/>
</phpunit>