Skip to content

Commit 9d1f4ed

Browse files
author
lalshe
committed
Use @require annotation to run test only on php 7.4
1 parent 3664426 commit 9d1f4ed

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed

tests/Symfony/SymfonyMessageSerializerTest.php

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -244,48 +244,46 @@ static function (Author $author): string
244244
/**
245245
* @test
246246
*
247+
* @requires PHP >= 7.4
248+
*
247249
* @throws \Throwable
248250
*/
249251
public function legacyPropertiesSupport(): void
250252
{
251-
if (\PHP_VERSION_ID >= 70400)
252-
{
253-
$serializer = new SymfonyMessageSerializer();
254-
255-
$object = new MixedWithLegacy(
256-
'qwerty',
257-
new \DateTimeImmutable('2019-01-01', new \DateTimeZone('UTC')),
258-
100500
259-
);
260-
261-
/** @var MixedWithLegacy $unserialized */
262-
$unserialized = $serializer->decode($serializer->encode($object));
263-
264-
static::assertSame($object->string, $unserialized->string);
265-
static::assertSame($object->dateTime->getTimestamp(), $unserialized->dateTime->getTimestamp());
266-
static::assertSame($object->long, $unserialized->long);
267-
}
253+
$serializer = new SymfonyMessageSerializer();
254+
255+
$object = new MixedWithLegacy(
256+
'qwerty',
257+
new \DateTimeImmutable('2019-01-01', new \DateTimeZone('UTC')),
258+
100500
259+
);
260+
261+
/** @var MixedWithLegacy $unserialized */
262+
$unserialized = $serializer->decode($serializer->encode($object));
263+
264+
static::assertSame($object->string, $unserialized->string);
265+
static::assertSame($object->dateTime->getTimestamp(), $unserialized->dateTime->getTimestamp());
266+
static::assertSame($object->long, $unserialized->long);
268267
}
269268

270269
/**
271270
* @test
272271
*
272+
* @requires PHP >= 7.4
273+
*
273274
* @throws \Throwable
274275
*/
275276
public function privateMixedPropertiesSupport(): void
276277
{
277-
if (\PHP_VERSION_ID >= 70400)
278-
{
279-
$serializer = new SymfonyMessageSerializer();
280-
281-
$object = new WithPrivateProperties(
282-
'Some string',
283-
100500,
284-
now()
285-
);
286-
287-
/** @var WithPrivateProperties $unserialized */
288-
$unserialized = $serializer->decode($serializer->encode($object));
289-
}
278+
$serializer = new SymfonyMessageSerializer();
279+
280+
$object = new WithPrivateProperties(
281+
'Some string',
282+
100500,
283+
now()
284+
);
285+
286+
/** @var WithPrivateProperties $unserialized */
287+
$unserialized = $serializer->decode($serializer->encode($object));
290288
}
291289
}

0 commit comments

Comments
 (0)