summaryrefslogtreecommitdiff
path: root/www/wiki/vendor/param-processor/param-processor/tests/Integration/Definitions/BoolParamTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/vendor/param-processor/param-processor/tests/Integration/Definitions/BoolParamTest.php')
-rw-r--r--www/wiki/vendor/param-processor/param-processor/tests/Integration/Definitions/BoolParamTest.php72
1 files changed, 72 insertions, 0 deletions
diff --git a/www/wiki/vendor/param-processor/param-processor/tests/Integration/Definitions/BoolParamTest.php b/www/wiki/vendor/param-processor/param-processor/tests/Integration/Definitions/BoolParamTest.php
new file mode 100644
index 00000000..d8b23f06
--- /dev/null
+++ b/www/wiki/vendor/param-processor/param-processor/tests/Integration/Definitions/BoolParamTest.php
@@ -0,0 +1,72 @@
+<?php
+
+namespace ParamProcessor\Tests\Integration\Definitions;
+
+/**
+ * @licence GNU GPL v2+
+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
+ */
+class BoolParamTest extends ParamDefinitionTest {
+
+ /**
+ * @see ParamDefinitionTest::getDefinitions
+ * @return array
+ */
+ public function getDefinitions() {
+ $params = parent::getDefinitions();
+
+ return $params;
+ }
+
+ /**
+ * @see ParamDefinitionTest::valueProvider
+ *
+ * @param boolean $stringlyTyped
+ *
+ * @return array
+ */
+ public function valueProvider( $stringlyTyped = true ) {
+ $values = [
+ 'empty' => [
+ [ 'yes', true, true ],
+ [ 'on', true, true ],
+ [ '1', true, true ],
+ [ 'no', true, false ],
+ [ 'off', true, false ],
+ [ '0', true, false ],
+ [ 'foobar', false ],
+ [ '2', false ],
+ [ [], false ],
+ [ 42, false ],
+ ],
+ 'values' => [],
+// 'values' => array(
+// array( '1', true, true ),
+// array( 'yes', true, true ),
+// array( 'no', false ),
+// array( 'foobar', false ),
+// ),
+ ];
+
+ if ( !$stringlyTyped ) {
+ foreach ( $values as &$set ) {
+ foreach ( $set as &$value ) {
+ if ( in_array( $value[0], [ 'yes', 'on', '1', '0', 'off', 'no' ], true ) ) {
+ $value[0] = in_array( $value[0], [ 'yes', 'on', '1' ], true );
+ }
+ }
+ }
+ }
+
+ return $values;
+ }
+
+ /**
+ * @see ParamDefinitionTest::getType
+ * @return string
+ */
+ public function getType() {
+ return 'boolean';
+ }
+
+}