You are here

public function GetSetMethodNormalizerTest::provideCallbacks in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php \Symfony\Component\Serializer\Tests\Normalizer\GetSetMethodNormalizerTest::provideCallbacks()

File

vendor/symfony/serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php, line 405

Class

GetSetMethodNormalizerTest

Namespace

Symfony\Component\Serializer\Tests\Normalizer

Code

public function provideCallbacks() {
  return array(
    array(
      array(
        'bar' => function ($bar) {
          return 'baz';
        },
      ),
      'baz',
      array(
        'foo' => '',
        'bar' => 'baz',
        'baz' => true,
      ),
      'Change a string',
    ),
    array(
      array(
        'bar' => function ($bar) {
          return;
        },
      ),
      'baz',
      array(
        'foo' => '',
        'bar' => null,
        'baz' => true,
      ),
      'Null an item',
    ),
    array(
      array(
        'bar' => function ($bar) {
          return $bar
            ->format('d-m-Y H:i:s');
        },
      ),
      new \DateTime('2011-09-10 06:30:00'),
      array(
        'foo' => '',
        'bar' => '10-09-2011 06:30:00',
        'baz' => true,
      ),
      'Format a date',
    ),
    array(
      array(
        'bar' => function ($bars) {
          $foos = '';
          foreach ($bars as $bar) {
            $foos .= $bar
              ->getFoo();
          }
          return $foos;
        },
      ),
      array(
        new GetConstructorDummy('baz', '', false),
        new GetConstructorDummy('quux', '', false),
      ),
      array(
        'foo' => '',
        'bar' => 'bazquux',
        'baz' => true,
      ),
      'Collect a property',
    ),
    array(
      array(
        'bar' => function ($bars) {
          return count($bars);
        },
      ),
      array(
        new GetConstructorDummy('baz', '', false),
        new GetConstructorDummy('quux', '', false),
      ),
      array(
        'foo' => '',
        'bar' => 2,
        'baz' => true,
      ),
      'Count a property',
    ),
  );
}