Die Provider-Klasse gehört in die Test-Helper.
This commit is contained in:
@@ -6,6 +6,7 @@ use Codeception\Test\Unit;
|
||||
use Exception;
|
||||
use TorstenHettstedt\Colors\ColorModels\CyanMagentaYellowKey;
|
||||
use TorstenHettstedt\Colors\Transformer\CyanMagentaYellowKeyTransformer;
|
||||
use TorstenHettstedtTests\Helper\ValidColorValuesProvider;
|
||||
|
||||
class CyanMagentaYellowKeyTransformerTest extends Unit
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ use Codeception\Test\Unit;
|
||||
use Exception;
|
||||
use TorstenHettstedt\Colors\ColorModels\HueSaturationValue;
|
||||
use TorstenHettstedt\Colors\Transformer\HueSaturationValueTransformer;
|
||||
use TorstenHettstedtTests\Helper\ValidColorValuesProvider;
|
||||
|
||||
class HueSaturationValueTransformerTest extends Unit
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ use Codeception\Test\Unit;
|
||||
use Exception;
|
||||
use TorstenHettstedt\Colors\ColorModels\RedGreenBlue;
|
||||
use TorstenHettstedt\Colors\Transformer\RedGreenBlueTransformer;
|
||||
use TorstenHettstedtTests\Helper\ValidColorValuesProvider;
|
||||
|
||||
class RedGreenBlueTransformerTest extends Unit
|
||||
{
|
||||
|
||||
@@ -1,209 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace TorstenHettstedtUnitTests\Colors\Transformer;
|
||||
|
||||
|
||||
class ValidColorValuesProvider
|
||||
{
|
||||
|
||||
const CMYK = 'cmyk';
|
||||
const RGB = 'rgb';
|
||||
const HSV = 'hsv';
|
||||
|
||||
protected array $definitions = [
|
||||
'weiß' => [
|
||||
self::CMYK => [
|
||||
'cyan' => 0.0,
|
||||
'magenta' => 0.0,
|
||||
'yellow' => 0.0,
|
||||
'key' => 0.0,
|
||||
],
|
||||
self::RGB => [
|
||||
'red' => 1.0,
|
||||
'green' => 1.0,
|
||||
'blue' => 1.0,
|
||||
],
|
||||
self::HSV => [
|
||||
'hue' => 0.0,
|
||||
'saturation' => 0.0,
|
||||
'value' => 1.0,
|
||||
],
|
||||
],
|
||||
'schwarz' => [
|
||||
self::CMYK => [
|
||||
'cyan' => 0.0,
|
||||
'magenta' => 0.0,
|
||||
'yellow' => 0.0,
|
||||
'key' => 1.0,
|
||||
],
|
||||
self::RGB => [
|
||||
'red' => 0.0,
|
||||
'green' => 0.0,
|
||||
'blue' => 0.0,
|
||||
],
|
||||
self::HSV => [
|
||||
'hue' => 0.0,
|
||||
'saturation' => 0.0,
|
||||
'value' => 0.0,
|
||||
],
|
||||
],
|
||||
'gelb' => [
|
||||
self::CMYK => [
|
||||
'cyan' => 0.0,
|
||||
'magenta' => 0.0,
|
||||
'yellow' => 1.0,
|
||||
'key' => 0.0,
|
||||
],
|
||||
self::RGB => [
|
||||
'red' => 1.0,
|
||||
'green' => 1.0,
|
||||
'blue' => 0.0,
|
||||
],
|
||||
self::HSV => [
|
||||
'hue' => 1.0 / 6.0,
|
||||
'saturation' => 1.0,
|
||||
'value' => 1.0,
|
||||
],
|
||||
],
|
||||
'grün' => [
|
||||
self::CMYK => [
|
||||
'cyan' => 1.0,
|
||||
'magenta' => 0.0,
|
||||
'yellow' => 1.0,
|
||||
'key' => 0.0,
|
||||
],
|
||||
self::RGB => [
|
||||
'red' => 0.0,
|
||||
'green' => 1.0,
|
||||
'blue' => 0.0,
|
||||
],
|
||||
self::HSV => [
|
||||
'hue' => 2.0 / 6.0,
|
||||
'saturation' => 1.0,
|
||||
'value' => 1.0,
|
||||
],
|
||||
],
|
||||
'cyan' => [
|
||||
self::CMYK => [
|
||||
'cyan' => 1.0,
|
||||
'magenta' => 0.0,
|
||||
'yellow' => 0.0,
|
||||
'key' => 0.0,
|
||||
],
|
||||
self::RGB => [
|
||||
'red' => 0.0,
|
||||
'green' => 1.0,
|
||||
'blue' => 1.0,
|
||||
],
|
||||
self::HSV => [
|
||||
'hue' => 3.0 / 6.0,
|
||||
'saturation' => 1.0,
|
||||
'value' => 1.0,
|
||||
],
|
||||
],
|
||||
'blau' => [
|
||||
self::CMYK => [
|
||||
'cyan' => 1.0,
|
||||
'magenta' => 1.0,
|
||||
'yellow' => 0.0,
|
||||
'key' => 0.0,
|
||||
],
|
||||
self::RGB => [
|
||||
'red' => 0.0,
|
||||
'green' => 0.0,
|
||||
'blue' => 1.0,
|
||||
],
|
||||
self::HSV => [
|
||||
'hue' => 4.0 / 6.0,
|
||||
'saturation' => 1.0,
|
||||
'value' => 1.0,
|
||||
],
|
||||
],
|
||||
'magenta' => [
|
||||
self::CMYK => [
|
||||
'cyan' => 0.0,
|
||||
'magenta' => 1.0,
|
||||
'yellow' => 0.0,
|
||||
'key' => 0.0,
|
||||
],
|
||||
self::RGB => [
|
||||
'red' => 1.0,
|
||||
'green' => 0.0,
|
||||
'blue' => 1.0,
|
||||
],
|
||||
self::HSV => [
|
||||
'hue' => 5.0 / 6.0,
|
||||
'saturation' => 1.0,
|
||||
'value' => 1.0,
|
||||
],
|
||||
],
|
||||
'rot' => [
|
||||
self::CMYK => [
|
||||
'cyan' => 0.0,
|
||||
'magenta' => 1.0,
|
||||
'yellow' => 1.0,
|
||||
'key' => 0.0,
|
||||
],
|
||||
self::RGB => [
|
||||
'red' => 1.0,
|
||||
'green' => 0.0,
|
||||
'blue' => 0.0,
|
||||
],
|
||||
self::HSV => [
|
||||
'hue' => 0.0,
|
||||
'saturation' => 1.0,
|
||||
'value' => 1.0,
|
||||
],
|
||||
],
|
||||
'gold' => [
|
||||
self::CMYK => [
|
||||
'cyan' => 0.0,
|
||||
'magenta' => 0.13,
|
||||
'yellow' => 0.76,
|
||||
'key' => 0.13,
|
||||
],
|
||||
self::RGB => [
|
||||
'red' => 0.87,
|
||||
'green' => 0.757,
|
||||
'blue' => 0.209,
|
||||
],
|
||||
self::HSV => [
|
||||
'hue' => 0.138,
|
||||
'saturation' => 0.76,
|
||||
'value' => 0.87,
|
||||
],
|
||||
],
|
||||
'violet' => [
|
||||
self::CMYK => [
|
||||
'cyan' => 0.191,
|
||||
'magenta' => 0.321,
|
||||
'yellow' => 0.0,
|
||||
'key' => 0.29,
|
||||
],
|
||||
self::RGB => [
|
||||
'red' => 0.575,
|
||||
'green' => 0.482,
|
||||
'blue' => 0.71,
|
||||
],
|
||||
self::HSV => [
|
||||
'hue' => 0.734,
|
||||
'saturation' => 0.321,
|
||||
'value' => 0.71,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
public function getValidColorValues(array $order): array
|
||||
{
|
||||
$values = [];
|
||||
foreach ($this->definitions as $color => $definition) {
|
||||
$definitions = [];
|
||||
foreach ($order as $key) {
|
||||
$definitions[] = $definition[$key];
|
||||
}
|
||||
$values[$color] = $definitions;
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user