|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * CssColorModuleValueProviderTrait.php |
| 4 | + * |
| 5 | + * @created 04.05.2024 |
| 6 | + * @author smiley <smiley@chillerlan.net> |
| 7 | + * @copyright 2024 smiley |
| 8 | + * @license MIT |
| 9 | + */ |
| 10 | + |
| 11 | +namespace chillerlan\QRCodeTest\Output; |
| 12 | + |
| 13 | +/** |
| 14 | + * A data provider for use in tests that include CssColorModuleValueTrait |
| 15 | + * |
| 16 | + * @see \chillerlan\QRCode\Output\CssColorModuleValueTrait |
| 17 | + */ |
| 18 | +trait CssColorModuleValueProviderTrait{ |
| 19 | + |
| 20 | + /** |
| 21 | + * @implements \chillerlan\QRCodeTest\Output\QROutputTestAbstract::moduleValueProvider() |
| 22 | + */ |
| 23 | + public static function moduleValueProvider():array{ |
| 24 | + return [ |
| 25 | + 'invalid: wrong type' => [[], false], |
| 26 | + 'valid: hex color (3)' => ['#abc', true], |
| 27 | + 'valid: hex color (4)' => ['#abcd', true], |
| 28 | + 'valid: hex color (6)' => ['#aabbcc', true], |
| 29 | + 'valid: hex color (8)' => ['#aabbccdd', true], |
| 30 | + 'invalid: hex color (non-hex)' => ['#aabbcxyz', false], |
| 31 | + 'invalid: hex color (too short)' => ['#aa', false], |
| 32 | + 'invalid: hex color (5)' => ['#aabbc', false], |
| 33 | + 'invalid: hex color (7)' => ['#aabbccd', false], |
| 34 | + 'valid: rgb(...%)' => ['rgb(100.0%, 0.0%, 0.0%)', true], |
| 35 | + 'valid: rgba(...)' => [' rgba(255, 0, 0, 1.0) ', true], |
| 36 | + 'valid: hsl(...)' => ['hsl(120, 60%, 50%)', true], |
| 37 | + 'valid: hsla(...)' => ['hsla(120, 255, 191.25, 1.0)', true], |
| 38 | + 'invalid: rgba(non-numeric)' => ['rgba(255, 0, whatever, 0, 1.0)', false], |
| 39 | + 'invalid: rgba(extra-char)' => ['rgba(255, 0, 0, 1.0);', false], |
| 40 | + 'valid: csscolor' => ['purple', true], |
| 41 | + 'invalid: c5sc0lor' => ['c5sc0lor', false], |
| 42 | + ]; |
| 43 | + } |
| 44 | + |
| 45 | +} |
0 commit comments