dallgoot /
yaml
| 1 | <?php |
||
| 2 | require_once __DIR__.'/../vendor/autoload.php'; |
||
| 3 | |||
| 4 | use Dallgoot\Yaml\Yaml; |
||
| 5 | use Dallgoot\Yaml\Types\YamlObject; |
||
| 6 | |||
| 7 | //Getting some document as PHP variable $YamlObject |
||
| 8 | //the document here is a PHP file used for tests |
||
| 9 | $testName = 'yamlObject_properties'; |
||
| 10 | $yamlObject = (include "tests/cases/dumping/$testName.php"); |
||
| 11 | |||
| 12 | //transform $yamlObject to YAML |
||
| 13 | $text = Yaml::dump($yamlObject, 0); |
||
| 14 | |||
| 15 | //getting the tests results |
||
| 16 | $nameResultPair = get_object_vars((YamlObject) Yaml::parseFile('tests/definitions/dumping_tests.yml')); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 17 | |||
| 18 | //verify that the text(yaml) we got is the same as we expected for this test |
||
| 19 | if ($nameResultPair[$testName] === $text) { |
||
| 20 | echo 'WRITE OK !!!'; |
||
| 21 | } else { |
||
| 22 | print_r('EXPECTED'. $nameResultPair[$testName]); |
||
| 23 | print_r('RECEIVED'. $text); |
||
| 24 | } |
||
| 25 |