/**
  * Test input and output data equality.
  *
  * @return  void
  *
  * @since   1.3.0
  */
 public function testDataEquality()
 {
     $input = "foo: bar\nquoted: '\"stringwithquotes\"'\nbooleantrue: true\nbooleanfalse: false\nnumericint: 42\nnumericfloat: 3.1415\n" . "section:\n    key: value\narray:\n    nestedarray: { test1: value1 }\n";
     $object = $this->fixture->stringToObject($input);
     $output = $this->fixture->objectToString($object);
     $this->assertEquals($input, $output, 'Line:' . __LINE__ . ' Input and output data must be equal.');
 }
Example #2
0
    /**
     * Test the stringToObject method.
     *
     * @return  void
     *
     * @since   1.0
     */
    public function testStringToObject()
    {
        $object = (object) array('foo' => 'bar', 'quoted' => '"stringwithquotes"', 'booleantrue' => true, 'booleanfalse' => false, 'numericint' => 42, 'numericfloat' => 3.1415, 'section' => (object) array('key' => 'value'), 'array' => (object) array('nestedarray' => (object) array('test1' => 'value1')));
        $yaml = 'foo: bar
quoted: \'"stringwithquotes"\'
booleantrue: true
booleanfalse: false
numericint: 42
numericfloat: 3.1415
section:
    key: value
array:
    nestedarray: { test1: value1 }
';
        $this->assertEquals($object, $this->fixture->stringToObject($yaml));
    }