You are here

public function ExporterTest::testExport2 in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/sebastian/exporter/tests/ExporterTest.php \SebastianBergmann\Exporter\ExporterTest::testExport2()

File

vendor/sebastian/exporter/tests/ExporterTest.php, line 183

Class

ExporterTest
@covers SebastianBergmann\Exporter\Exporter

Namespace

SebastianBergmann\Exporter

Code

public function testExport2() {
  if (PHP_VERSION === '5.3.3') {
    $this
      ->markTestSkipped('Skipped due to "Nesting level too deep - recursive dependency?" fatal error');
  }
  $obj = new \stdClass();
  $obj->foo = 'bar';
  $array = array(
    0 => 0,
    'null' => null,
    'boolean' => true,
    'integer' => 1,
    'double' => 1.2,
    'string' => '1',
    'text' => "this\nis\na\nvery\nvery\nvery\nvery\nvery\nvery\rlong\n\rtext",
    'object' => $obj,
    'objectagain' => $obj,
    'array' => array(
      'foo' => 'bar',
    ),
  );
  $array['self'] =& $array;
  $expected = <<<EOF
Array &%d (
    0 => 0
    'null' => null
    'boolean' => true
    'integer' => 1
    'double' => 1.2
    'string' => '1'
    'text' => 'this
is
a
very
very
very
very
very
very
long
text'
    'object' => stdClass Object &%x (
        'foo' => 'bar'
    )
    'objectagain' => stdClass Object &%x
    'array' => Array &%d (
        'foo' => 'bar'
    )
    'self' => Array &%d (
        0 => 0
        'null' => null
        'boolean' => true
        'integer' => 1
        'double' => 1.2
        'string' => '1'
        'text' => 'this
is
a
very
very
very
very
very
very
long
text'
        'object' => stdClass Object &%x
        'objectagain' => stdClass Object &%x
        'array' => Array &%d (
            'foo' => 'bar'
        )
        'self' => Array &%d
    )
)
EOF;
  $this
    ->assertStringMatchesFormat($expected, $this
    ->trimNewline($this->exporter
    ->export($array)));
}