Skip to content

Commit 8d34959

Browse files
committed
minor #22380 fix risky tests (xabbuh)
This PR was merged into the 3.2 branch. Discussion ---------- fix risky tests | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- 9125911 fix risky tests
2 parents ed1e8fb + 9125911 commit 8d34959

File tree

6 files changed

+29
-14
lines changed

6 files changed

+29
-14
lines changed

src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function testTypeConversionsWithNativePhp($key, $value, $supported)
5555
}
5656

5757
if (!$supported) {
58-
return;
58+
$this->markTestSkipped(sprintf('Converting the value "%s" to "%s" is not supported by the IniFileLoader.', $key, $value));
5959
}
6060

6161
$this->loader->load('types.ini');

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,10 @@ public function testChownLink()
593593

594594
$this->filesystem->hardlink($file, $link);
595595

596-
$this->filesystem->chown($link, $this->getFileOwner($link));
596+
$owner = $this->getFileOwner($link);
597+
$this->filesystem->chown($link, $owner);
598+
599+
$this->assertSame($owner, $this->getFileOwner($link));
597600
}
598601

599602
/**
@@ -699,7 +702,10 @@ public function testChgrpLink()
699702

700703
$this->filesystem->hardlink($file, $link);
701704

702-
$this->filesystem->chgrp($link, $this->getFileGroup($link));
705+
$group = $this->getFileGroup($link);
706+
$this->filesystem->chgrp($link, $group);
707+
708+
$this->assertSame($group, $this->getFileGroup($link));
703709
}
704710

705711
/**

src/Symfony/Component/Form/Tests/Extension/Core/Type/DateIntervalTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Form\Extension\Core\Type\DateIntervalType;
1515
use Symfony\Component\Form\FormError;
16+
use Symfony\Component\Form\FormInterface;
1617

1718
class DateIntervalTypeTest extends BaseTypeTest
1819
{
@@ -195,7 +196,7 @@ public function testInitializeWithDateInterval()
195196
{
196197
// Throws an exception if "data_class" option is not explicitly set
197198
// to null in the type
198-
$this->factory->create(static::TESTED_TYPE, new \DateInterval('P0Y'));
199+
$this->assertInstanceOf(FormInterface::class, $this->factory->create(static::TESTED_TYPE, new \DateInterval('P0Y')));
199200
}
200201

201202
public function testPassDefaultPlaceholderToViewIfNotRequired()

src/Symfony/Component/HttpFoundation/Tests/RequestTest.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ public function testDuplicateWithFormat()
295295
}
296296

297297
/**
298-
* @dataProvider getFormatToMimeTypeMapProvider
298+
* @dataProvider getFormatToMimeTypeMapProviderWithAdditionalNullFormat
299299
*/
300300
public function testGetFormatFromMimeType($format, $mimeTypes)
301301
{
@@ -313,6 +313,14 @@ public function testGetFormatFromMimeType($format, $mimeTypes)
313313
}
314314
}
315315

316+
public function getFormatToMimeTypeMapProviderWithAdditionalNullFormat()
317+
{
318+
return array_merge(
319+
array(array(null, array(null, 'unexistent-mime-type'))),
320+
$this->getFormatToMimeTypeMapProvider()
321+
);
322+
}
323+
316324
public function testGetFormatFromMimeTypeWithParameters()
317325
{
318326
$request = new Request();
@@ -324,20 +332,16 @@ public function testGetFormatFromMimeTypeWithParameters()
324332
*/
325333
public function testGetMimeTypeFromFormat($format, $mimeTypes)
326334
{
327-
if (null !== $format) {
328-
$request = new Request();
329-
$this->assertEquals($mimeTypes[0], $request->getMimeType($format));
330-
}
335+
$request = new Request();
336+
$this->assertEquals($mimeTypes[0], $request->getMimeType($format));
331337
}
332338

333339
/**
334340
* @dataProvider getFormatToMimeTypeMapProvider
335341
*/
336342
public function testGetMimeTypesFromFormat($format, $mimeTypes)
337343
{
338-
if (null !== $format) {
339-
$this->assertEquals($mimeTypes, Request::getMimeTypes($format));
340-
}
344+
$this->assertEquals($mimeTypes, Request::getMimeTypes($format));
341345
}
342346

343347
public function testGetMimeTypesFromInexistentFormat()
@@ -357,7 +361,6 @@ public function testGetFormatWithCustomMimeType()
357361
public function getFormatToMimeTypeMapProvider()
358362
{
359363
return array(
360-
array(null, array(null, 'unexistent-mime-type')),
361364
array('txt', array('text/plain')),
362365
array('js', array('application/javascript', 'application/x-javascript', 'text/javascript')),
363366
array('css', array('text/css')),

src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,10 @@ public function testNoDeprecationsAreTriggered()
849849
{
850850
new DefaultResponse();
851851
$this->getMockBuilder(Response::class)->getMock();
852+
853+
// we just need to ensure that subclasses of Response can be created without any deprecations
854+
// being triggered if the subclass does not override any final methods
855+
$this->addToAssertionCount(1);
852856
}
853857

854858
/**

src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ public function testInstantiateObjectDenormalizer()
3636
$context = array();
3737

3838
$normalizer = new AbstractObjectNormalizerDummy();
39-
$normalizer->instantiateObject($data, $class, $context, new \ReflectionClass($class), array());
39+
40+
$this->assertInstanceOf(__NAMESPACE__.'\Dummy', $normalizer->instantiateObject($data, $class, $context, new \ReflectionClass($class), array()));
4041
}
4142
}
4243

0 commit comments

Comments
 (0)