public function ObjectNormalizerTest::provideCallbacks in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/serializer/Tests/Normalizer/ObjectNormalizerTest.php \Symfony\Component\Serializer\Tests\Normalizer\ObjectNormalizerTest::provideCallbacks()
File
- vendor/
symfony/ serializer/ Tests/ Normalizer/ ObjectNormalizerTest.php, line 325
Class
- ObjectNormalizerTest
- @author Kévin Dunglas <dunglas@gmail.com>
Namespace
Symfony\Component\Serializer\Tests\NormalizerCode
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 ObjectConstructorDummy('baz', '', false),
new ObjectConstructorDummy('quux', '', false),
),
array(
'foo' => '',
'bar' => 'bazquux',
'baz' => true,
),
'Collect a property',
),
array(
array(
'bar' => function ($bars) {
return count($bars);
},
),
array(
new ObjectConstructorDummy('baz', '', false),
new ObjectConstructorDummy('quux', '', false),
),
array(
'foo' => '',
'bar' => 2,
'baz' => true,
),
'Count a property',
),
);
}