File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -773,6 +773,13 @@ The ``@testdox`` annotation can be applied to both test classes and test methods
773
773
Instead of implementing a method for use with ``@dataProvider ``,
774
774
you can define a data set using the ``@testWith `` annotation.
775
775
776
+ A data set consists of one or many elements. To define a data set
777
+ with multiple elements, define each element in a separate line.
778
+ Each element of the data set must be an array defined in JSON.
779
+
780
+ See :ref: `writing-tests-for-phpunit.data-providers ` to learn
781
+ more about passing a set of data to a test.
782
+
776
783
.. code-block :: php
777
784
778
785
/**
@@ -787,6 +794,21 @@ you can define a data set using the ``@testWith`` annotation.
787
794
$this->assertSame($expectedLength, strlen($input));
788
795
}
789
796
797
+ An object representation in JSON will be converted into an associative array.
798
+
799
+ .. code-block :: php
800
+
801
+ /**
802
+ * @param array $array
803
+ * @param array $keys
804
+ *
805
+ * @testWith [{"day": "monday", "conditions": "sunny"}, ["day", "conditions"]]
806
+ */
807
+ public function testArrayKeys($array, $keys)
808
+ {
809
+ $this->assertSame($keys, array_keys($array));
810
+ }
811
+
790
812
.. _appendixes.annotations.ticket :
791
813
792
814
@ticket
You can’t perform that action at this time.
0 commit comments