fix risky tests

This commit is contained in:
Christian Flothmann 2017-04-11 11:53:09 +02:00
parent d41a3a56c2
commit 9125911668
6 changed files with 29 additions and 14 deletions

View File

@ -55,7 +55,7 @@ class IniFileLoaderTest extends TestCase
}
if (!$supported) {
return;
$this->markTestSkipped(sprintf('Converting the value "%s" to "%s" is not supported by the IniFileLoader.', $key, $value));
}
$this->loader->load('types.ini');

View File

@ -593,7 +593,10 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->hardlink($file, $link);
$this->filesystem->chown($link, $this->getFileOwner($link));
$owner = $this->getFileOwner($link);
$this->filesystem->chown($link, $owner);
$this->assertSame($owner, $this->getFileOwner($link));
}
/**
@ -699,7 +702,10 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->hardlink($file, $link);
$this->filesystem->chgrp($link, $this->getFileGroup($link));
$group = $this->getFileGroup($link);
$this->filesystem->chgrp($link, $group);
$this->assertSame($group, $this->getFileGroup($link));
}
/**

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type;
use Symfony\Component\Form\Extension\Core\Type\DateIntervalType;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormInterface;
class DateIntervalTypeTest extends BaseTypeTest
{
@ -195,7 +196,7 @@ class DateIntervalTypeTest extends BaseTypeTest
{
// Throws an exception if "data_class" option is not explicitly set
// to null in the type
$this->factory->create(static::TESTED_TYPE, new \DateInterval('P0Y'));
$this->assertInstanceOf(FormInterface::class, $this->factory->create(static::TESTED_TYPE, new \DateInterval('P0Y')));
}
public function testPassDefaultPlaceholderToViewIfNotRequired()

View File

@ -295,7 +295,7 @@ class RequestTest extends TestCase
}
/**
* @dataProvider getFormatToMimeTypeMapProvider
* @dataProvider getFormatToMimeTypeMapProviderWithAdditionalNullFormat
*/
public function testGetFormatFromMimeType($format, $mimeTypes)
{
@ -313,6 +313,14 @@ class RequestTest extends TestCase
}
}
public function getFormatToMimeTypeMapProviderWithAdditionalNullFormat()
{
return array_merge(
array(array(null, array(null, 'unexistent-mime-type'))),
$this->getFormatToMimeTypeMapProvider()
);
}
public function testGetFormatFromMimeTypeWithParameters()
{
$request = new Request();
@ -324,10 +332,8 @@ class RequestTest extends TestCase
*/
public function testGetMimeTypeFromFormat($format, $mimeTypes)
{
if (null !== $format) {
$request = new Request();
$this->assertEquals($mimeTypes[0], $request->getMimeType($format));
}
$request = new Request();
$this->assertEquals($mimeTypes[0], $request->getMimeType($format));
}
/**
@ -335,9 +341,7 @@ class RequestTest extends TestCase
*/
public function testGetMimeTypesFromFormat($format, $mimeTypes)
{
if (null !== $format) {
$this->assertEquals($mimeTypes, Request::getMimeTypes($format));
}
$this->assertEquals($mimeTypes, Request::getMimeTypes($format));
}
public function testGetMimeTypesFromInexistentFormat()
@ -357,7 +361,6 @@ class RequestTest extends TestCase
public function getFormatToMimeTypeMapProvider()
{
return array(
array(null, array(null, 'unexistent-mime-type')),
array('txt', array('text/plain')),
array('js', array('application/javascript', 'application/x-javascript', 'text/javascript')),
array('css', array('text/css')),

View File

@ -849,6 +849,10 @@ class ResponseTest extends ResponseTestCase
{
new DefaultResponse();
$this->getMockBuilder(Response::class)->getMock();
// we just need to ensure that subclasses of Response can be created without any deprecations
// being triggered if the subclass does not override any final methods
$this->addToAssertionCount(1);
}
/**

View File

@ -36,7 +36,8 @@ class AbstractObjectNormalizerTest extends TestCase
$context = array();
$normalizer = new AbstractObjectNormalizerDummy();
$normalizer->instantiateObject($data, $class, $context, new \ReflectionClass($class), array());
$this->assertInstanceOf(__NAMESPACE__.'\Dummy', $normalizer->instantiateObject($data, $class, $context, new \ReflectionClass($class), array()));
}
}