This commit is contained in:
Fabien Potencier 2012-12-11 11:40:22 +01:00
parent d2885adffe
commit 7f3be5c49d
20 changed files with 23 additions and 31 deletions

View File

@ -86,4 +86,4 @@ class DoctrineOrmTypeGuesserTest extends \PHPUnit_Framework_TestCase
return new DoctrineOrmTypeGuesser($registry); return new DoctrineOrmTypeGuesser($registry);
} }
} }

View File

@ -11,7 +11,6 @@
namespace Symfony\Bridge\Doctrine\Tests\Logger; namespace Symfony\Bridge\Doctrine\Tests\Logger;
class DbalLoggerTest extends \PHPUnit_Framework_TestCase class DbalLoggerTest extends \PHPUnit_Framework_TestCase
{ {
/** /**

View File

@ -23,7 +23,7 @@ class EnumNodeDefinition extends ScalarNodeDefinition
} }
$this->values = $values; $this->values = $values;
return $this; return $this;
} }
@ -40,4 +40,4 @@ class EnumNodeDefinition extends ScalarNodeDefinition
return new EnumNode($this->name, $this->parent, $this->values); return new EnumNode($this->name, $this->parent, $this->values);
} }
} }

View File

@ -239,7 +239,6 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$this->assertRegExp('/Did you mean this/', $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with one alternative'); $this->assertRegExp('/Did you mean this/', $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with one alternative');
} }
$application->add(new \Foo1Command()); $application->add(new \Foo1Command());
$application->add(new \Foo2Command()); $application->add(new \Foo2Command());

View File

@ -9,7 +9,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Symfony\Component\Console\Tests\Formatter; namespace Symfony\Component\Console\Tests\Formatter;
use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Formatter\OutputFormatter;

View File

@ -360,7 +360,7 @@ class Filesystem
if ($copyOnWindows) { if ($copyOnWindows) {
if (is_link($file) || is_file($file)) { if (is_link($file) || is_file($file)) {
$this->copy($file, $target, isset($options['override']) ? $options['override'] : false); $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
} else if (is_dir($file)) { } elseif (is_dir($file)) {
$this->mkdir($target); $this->mkdir($target);
} else { } else {
throw new IOException(sprintf('Unable to guess "%s" file type.', $file)); throw new IOException(sprintf('Unable to guess "%s" file type.', $file));
@ -368,9 +368,9 @@ class Filesystem
} else { } else {
if (is_link($file)) { if (is_link($file)) {
$this->symlink($file, $target); $this->symlink($file, $target);
} else if (is_dir($file)) { } elseif (is_dir($file)) {
$this->mkdir($target); $this->mkdir($target);
} else if (is_file($file)) { } elseif (is_file($file)) {
$this->copy($file, $target, isset($options['override']) ? $options['override'] : false); $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
} else { } else {
throw new IOException(sprintf('Unable to guess "%s" file type.', $file)); throw new IOException(sprintf('Unable to guess "%s" file type.', $file));

View File

@ -53,7 +53,6 @@ class DateTimeToRfc3339Transformer extends BaseDateTimeTransformer
return null; return null;
} }
$dateTime = new \DateTime($rfc3339); $dateTime = new \DateTime($rfc3339);
if ($this->outputTimezone !== $this->inputTimezone) { if ($this->outputTimezone !== $this->inputTimezone) {

View File

@ -46,7 +46,7 @@ class FileType extends AbstractType
{ {
$resolver->setDefaults(array( $resolver->setDefaults(array(
'compound' => false, 'compound' => false,
'data_class' => 'Symfony\Component\HttpFoundation\File\File' 'data_class' => 'Symfony\Component\HttpFoundation\File\File'
)); ));
} }

View File

@ -90,7 +90,7 @@ abstract class Guess
*/ */
public function __construct($confidence) public function __construct($confidence)
{ {
if (self::VERY_HIGH_CONFIDENCE !== $confidence && self::HIGH_CONFIDENCE !== $confidence && if (self::VERY_HIGH_CONFIDENCE !== $confidence && self::HIGH_CONFIDENCE !== $confidence &&
self::MEDIUM_CONFIDENCE !== $confidence && self::LOW_CONFIDENCE !== $confidence) { self::MEDIUM_CONFIDENCE !== $confidence && self::LOW_CONFIDENCE !== $confidence) {
throw new \InvalidArgumentException('The confidence should be one of the constants defined in Guess.'); throw new \InvalidArgumentException('The confidence should be one of the constants defined in Guess.');
} }

View File

@ -18,4 +18,3 @@ abstract class DateTimeTestCase extends LocalizedTestCase
self::assertEquals($expected->format('c'), $actual->format('c')); self::assertEquals($expected->format('c'), $actual->format('c'));
} }
} }

View File

@ -227,7 +227,6 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase
{ {
// The mapping must be deterministic! If a child has the property path "[street]", // The mapping must be deterministic! If a child has the property path "[street]",
// "data[street]" should be mapped, but "data.street" should not! // "data[street]" should be mapped, but "data.street" should not!
return array( return array(
// mapping target, child name, its property path, grand child name, its property path, violation path // mapping target, child name, its property path, grand child name, its property path, violation path
array(self::LEVEL_0, 'address', 'address', 'street', 'street', ''), array(self::LEVEL_0, 'address', 'address', 'street', 'street', ''),
@ -1260,7 +1259,6 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase
// 1) the error actually maps to an existing child and // 1) the error actually maps to an existing child and
// 2) the property path of that child (relative to the form providing // 2) the property path of that child (relative to the form providing
// the mapping) matches the left side of the mapping // the mapping) matches the left side of the mapping
return array( return array(
// mapping target, map from, map to, child name, its property path, grand child name, its property path, violation path // mapping target, map from, map to, child name, its property path, grand child name, its property path, violation path
array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].children[street].data'), array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].children[street].data'),

View File

@ -155,7 +155,6 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
array('justOne' => true) array('justOne' => true)
); );
$this->storage->destroy('foo'); $this->storage->destroy('foo');
} }
@ -183,7 +182,7 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
$collection->expects($this->once()) $collection->expects($this->once())
->method('remove') ->method('remove')
->will($this->returnCallback(function($citeria) use($that) { ->will($this->returnCallback(function($citeria) use ($that) {
$that->assertInstanceOf('MongoTimestamp', $citeria[$that->options['time_field']]['$lt']); $that->assertInstanceOf('MongoTimestamp', $citeria[$that->options['time_field']]['$lt']);
$that->assertGreaterThanOrEqual(time() - -1, $citeria[$that->options['time_field']]['$lt']->sec); $that->assertGreaterThanOrEqual(time() - -1, $citeria[$that->options['time_field']]['$lt']->sec);
})); }));

View File

@ -54,6 +54,7 @@ class NativeFileSessionHandlerTest extends \PHPUnit_Framework_TestCase
public function savePathDataProvider() public function savePathDataProvider()
{ {
$base = sys_get_temp_dir(); $base = sys_get_temp_dir();
return array( return array(
array("$base/foo", "$base/foo", "$base/foo"), array("$base/foo", "$base/foo", "$base/foo"),
array("5;$base/foo", "5;$base/foo", "$base/foo"), array("5;$base/foo", "5;$base/foo", "$base/foo"),

View File

@ -40,7 +40,7 @@ class MongoDbProfilerStorageTestDataCollector extends DataCollector
public function collect(Request $request, Response $response, \Exception $exception = null) public function collect(Request $request, Response $response, \Exception $exception = null)
{ {
} }
public function getName() public function getName()
{ {
return 'test_data_collector'; return 'test_data_collector';
@ -126,4 +126,3 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
} }
} }
} }

View File

@ -125,7 +125,8 @@ function get_data($index, $dataDir, $locale = 'en', $constraint = null)
return $data; return $data;
} }
function icu_version() { function icu_version()
{
exec('icu-config --version', $output, $result); exec('icu-config --version', $output, $result);
if ($result !== 0 || !isset($output[0])) { if ($result !== 0 || !isset($output[0])) {
@ -135,13 +136,15 @@ function icu_version() {
return $output[0]; return $output[0];
} }
function normalize_icu_version($version) { function normalize_icu_version($version)
{
preg_match('/^(?P<version>[0-9]\.[0-9]|[0-9]{2,})/', $version, $matches); preg_match('/^(?P<version>[0-9]\.[0-9]|[0-9]{2,})/', $version, $matches);
return $matches['version']; return $matches['version'];
} }
function download_icu_data($version) { function download_icu_data($version)
{
$icu = parse_ini_file(__DIR__.'/icu.ini'); $icu = parse_ini_file(__DIR__.'/icu.ini');
if (!isset($icu[$version])) { if (!isset($icu[$version])) {
@ -624,4 +627,4 @@ create_stub_datafile($defaultLocale, $stubRegionDir, $countries);
// Clean up // Clean up
clear_directory($currDir); clear_directory($currDir);
rmdir($currDir); rmdir($currDir);

View File

@ -16,7 +16,7 @@ namespace Symfony\Component\Process\Tests;
*/ */
abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
{ {
protected abstract function getProcess($commandline, $cwd = null, array $env = null, $stdin = null, $timeout = 60, array $options = array()); abstract protected function getProcess($commandline, $cwd = null, array $env = null, $stdin = null, $timeout = 60, array $options = array());
/** /**
* @expectedException \InvalidArgumentException * @expectedException \InvalidArgumentException
@ -233,7 +233,6 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
$this->markTestSkipped('Windows does not support POSIX signals'); $this->markTestSkipped('Windows does not support POSIX signals');
} }
$process = $this->getProcess('php -r "while (true) {}"'); $process = $this->getProcess('php -r "while (true) {}"');
$process->start(); $process->start();
$process->stop(); $process->stop();

View File

@ -214,7 +214,7 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
$routes = $this->getRoutes('test', new Route('/', array(), array('_scheme' => 'http'))); $routes = $this->getRoutes('test', new Route('/', array(), array('_scheme' => 'http')));
$this->assertEquals('http://localhost/app.php/', $this->getGenerator($routes, array('scheme' => 'https'))->generate('test')); $this->assertEquals('http://localhost/app.php/', $this->getGenerator($routes, array('scheme' => 'https'))->generate('test'));
} }
public function testPathWithTwoStartingSlashes() public function testPathWithTwoStartingSlashes()
{ {
$routes = $this->getRoutes('test', new Route('//path-and-not-domain')); $routes = $this->getRoutes('test', new Route('//path-and-not-domain'));

View File

@ -58,7 +58,6 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle
return $this->httpUtils->createRedirectResponse($request, $this->determineTargetUrl($request)); return $this->httpUtils->createRedirectResponse($request, $this->determineTargetUrl($request));
} }
/** /**
* Get the provider key. * Get the provider key.
* *

View File

@ -62,7 +62,7 @@ class Regex extends Constraint
* Convert the htmlPattern to a suitable format for HTML5 pattern. * Convert the htmlPattern to a suitable format for HTML5 pattern.
* Example: /^[a-z]+$/ would be converted to [a-z]+ * Example: /^[a-z]+$/ would be converted to [a-z]+
* However, if options are specified, it cannot be converted * However, if options are specified, it cannot be converted
* *
* Pattern is also ignored if match=false since the pattern should * Pattern is also ignored if match=false since the pattern should
* then be reversed before application. * then be reversed before application.
* *
@ -78,7 +78,7 @@ class Regex extends Constraint
if (!$this->match) { if (!$this->match) {
return null; return null;
} }
if (preg_match('/^(.)(\^?)(.*?)(\$?)\1$/', $this->pattern, $matches)) { if (preg_match('/^(.)(\^?)(.*?)(\$?)\1$/', $this->pattern, $matches)) {
$delimiter = $matches[1]; $delimiter = $matches[1];
$start = empty($matches[2]) ? '.*' : ''; $start = empty($matches[2]) ? '.*' : '';

View File

@ -162,7 +162,7 @@ class RegexValidatorTest extends \PHPUnit_Framework_TestCase
'pattern' => '/[a-z]+/', 'pattern' => '/[a-z]+/',
)); ));
$this->assertEquals('.*[a-z]+.*', $constraint->getHtmlPattern()); $this->assertEquals('.*[a-z]+.*', $constraint->getHtmlPattern());
// Dropped because of match=false // Dropped because of match=false
$constraint = new Regex(array( $constraint = new Regex(array(
'pattern' => '/[a-z]+/', 'pattern' => '/[a-z]+/',
@ -170,5 +170,4 @@ class RegexValidatorTest extends \PHPUnit_Framework_TestCase
)); ));
$this->assertNull($constraint->getHtmlPattern()); $this->assertNull($constraint->getHtmlPattern());
} }
} }