8000 Removed assertDateTimeEquals() methods by derrabus · Pull Request #25943 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Removed assertDateTimeEquals() methods #25943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
8000 Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/Symfony/Component/Form/Test/TypeTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,4 @@ protected function setUp()
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
$this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
}

public static function assertDateTimeEquals(\DateTime $expected, \DateTime $actual)
{
self::assertEquals($expected->format('c'), $actual->format('c'));
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@

namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;

class DateTimeToArrayTransformerTest extends DateTimeTestCase
class DateTimeToArrayTransformerTest extends TestCase
{
public function testTransform()
{
Expand Down Expand Up @@ -163,7 +164,7 @@ public function testReverseTransform()

$output = new \DateTime('2010-02-03 04:05:06 UTC');

$this->assertDateTimeEquals($output, $transformer->reverseTransform($input));
$this->assertEquals($output, $transformer->reverseTransform($input));
}

public function testReverseTransformWithSomeZero()
Expand All @@ -181,7 +182,7 @@ public function testReverseTransformWithSomeZero()

$output = new \DateTime('2010-02-03 04:00:00 UTC');

$this->assertDateTimeEquals($output, $transformer->reverseTransform($input));
$this->assertEquals($output, $transformer->reverseTransform($input));
}

public function testReverseTransformCompletelyEmpty()
Expand Down Expand Up @@ -326,7 +327,7 @@ public function testReverseTransformDifferentTimezones()
$output = new \DateTime('2010-02-03 04:05:06 Asia/Hong_Kong');
$output->setTimezone(new \DateTimeZone('America/New_York'));

$this->assertDateTimeEquals($output, $transformer->reverseTransform($input));
$this->assertEquals($output, $transformer->reverseTransform($input));
}

public function testReverseTransformToDifferentTimezone()
Expand All @@ -345,7 +346,7 @@ public function testReverseTransformToDifferentTimezone()
$output = new \DateTime('2010-02-03 04:05:06 UTC');
$output->setTimezone(new \DateTimeZone('Asia/Hong_Kong'));

$this->assertDateTimeEquals($output, $transformer->reverseTransform($input));
$this->assertEquals($output, $transformer->reverseTransform($input));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@

namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer;
use Symfony\Component\Intl\Util\IntlTestHelper;

class DateTimeToLocalizedStringTransformerTest extends DateTimeTestCase
class DateTimeToLocalizedStringTransformerTest extends TestCase
{
protected $dateTime;
protected $dateTimeWithoutSeconds;
Expand Down Expand Up @@ -226,7 +227,7 @@ public function testReverseTransformFullTime()
{
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, \IntlDateFormatter::FULL);

$this->assertDateTimeEquals($this->dateTime, $transformer->reverseTransform('03.02.2010, 04:05:06 GMT+00:00'));
$this->assertEquals($this->dateTime, $transformer->reverseTransform('03.02.2010, 04:05:06 GMT+00:00'));
}

public function testReverseTransformFromDifferentLocale()
Expand All @@ -235,7 +236,7 @@ public function testReverseTransformFromDifferentLocale()

$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC');

$this->assertDateTimeEquals($this->dateTimeWithoutSeconds, $transformer->reverseTransform('Feb 3, 2010, 04:05 AM'));
$this->assertEquals($this->dateTimeWithoutSeconds, $transformer->reverseTransform('Feb 3, 2010, 04:05 AM'));
}

public function testReverseTransformWithDifferentTimezones()
Expand All @@ -245,7 +246,7 @@ public function testReverseTransformWithDifferentTimezones()
$dateTime = new \DateTime('2010-02-03 04:05:00 Asia/Hong_Kong');
$dateTime->setTimezone(new \DateTimeZone('America/New_York'));

$this->assertDateTimeEquals($dateTime, $transformer->reverseTransform('03.02.2010, 04:05'));
$this->assertEquals($dateTime, $transformer->reverseTransform('03.02.2010, 04:05'));
}

public function testReverseTransformOnlyDateWithDifferentTimezones()
Expand All @@ -254,21 +255,21 @@ public function testReverseTransformOnlyDateWithDifferentTimezones()

$dateTime = new \DateTime('2017-01-10 11:00', new \DateTimeZone('Europe/Berlin'));

$this->assertDateTimeEquals($dateTime, $transformer->reverseTransform('2017-01-10'));
$this->assertEquals($dateTime, $transformer->reverseTransform('2017-01-10'));
}

public function testReverseTransformWithDifferentPatterns()
{
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', \IntlDateFormatter::FULL, \IntlDateFormatter::FULL, \IntlDateFormatter::GREGORIAN, 'MM*yyyy*dd HH|mm|ss');

$this->assertDateTimeEquals($this->dateTime, $transformer->reverseTransform('02*2010*03 04|05|06'));
$this->assertEquals($this->dateTime, $transformer->reverseTransform('02*2010*03 04|05|06'));
}

public function testReverseTransformDateOnlyWithDstIssue()
{
$transformer = new DateTimeToLocalizedStringTransformer('Europe/Rome', 'Europe/Rome', \IntlDateFormatter::FULL, \IntlDateFormatter::FULL, \IntlDateFormatter::GREGORIAN, 'dd/MM/yyyy');

$this->assertDateTimeEquals(
$this->assertEquals(
new \DateTime('1978-05-28', new \DateTimeZone('Europe/Rome')),
$transformer->reverseTransform('28/05/1978')
);
Expand All @@ -278,7 +279,7 @@ public function testReverseTransformDateOnlyWithDstIssueAndEscapedText()
{
$transformer = new DateTimeToLocalizedStringTransformer('Europe/Rome', 'Europe/Rome', \IntlDateFormatter::FULL, \IntlDateFormatter::FULL, \IntlDateFormatter::GREGORIAN, "'day': dd 'month': MM 'year': yyyy");

$this->assertDateTimeEquals(
$this->assertEquals(
new \DateTime('1978-05-28', new \DateTimeZone('Europe/Rome')),
$transformer->reverseTransform('day: 28 month: 05 year: 1978')
);
Expand Down Expand Up @@ -332,7 +333,7 @@ public function testReverseTransformWithNonExistingDate()
{
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', \IntlDateFormatter::SHORT);

$this->assertDateTimeEquals($this->dateTimeWithoutSeconds, $transformer->reverseTransform('31.04.10 04:05'));
$this->assertEquals($this->dateTimeWithoutSeconds, $transformer->reverseTransform('31.04.10 04:05'));
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@

namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToRfc3339Transformer;

class DateTimeToRfc3339TransformerTest extends DateTimeTestCase
class DateTimeToRfc3339TransformerTest extends TestCase
{
protected $dateTime;
protected $dateTimeWithoutSeconds;
Expand Down Expand Up @@ -107,9 +108,9 @@ public function testReverseTransform($toTz, $fromTz, $to, $from)
$transformer = new DateTimeToRfc3339Transformer($toTz, $fromTz);

if (null !== $to) {
$this->assertDateTimeEquals(new \DateTime($to), $transformer->reverseTransform($from));
$this->assertEquals(new \DateTime($to), $transformer->reverseTransform($from));
} else {
$this->assertSame($to, $transformer->reverseTransform($from));
$this->assertNull($transformer->reverseTransform($from));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@

namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;

class DateTimeToStringTransformerTest extends DateTimeTestCase
class DateTimeToStringTransformerTest extends TestCase
{
public function dataProvider()
{
Expand Down Expand Up @@ -126,7 +127,7 @@ public function testReverseTransform($format, $input, $output)

$output = new \DateTime($output);

$this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input));
$this->assertEquals($output, $reverseTransformer->reverseTransform($input));
}

public function testReverseTransformEmpty()
Expand All @@ -144,7 +145,7 @@ public function testReverseTransformWithDifferentTimezones()
$input = $output->format('Y-m-d H:i:s');
$output->setTimezone(new \DateTimeZone('America/New_York'));

$this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input));
$this->assertEquals($output, $reverseTransformer->reverseTransform($input));
}

public function testReverseTransformExpectsString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@

namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;

class DateTimeToTimestampTransformerTest extends DateTimeTestCase
class DateTimeToTimestampTransformerTest extends TestCase
{
public function testTransform()
{
Expand Down Expand Up @@ -86,7 +87,7 @@ public function testReverseTransform()
$output = new \DateTime('2010-02-03 04:05:06 UTC');
$input = $output->format('U');

$this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input));
$this->assertEquals($output, $reverseTransformer->reverseTransform($input));
}

public function testReverseTransformEmpty()
Expand All @@ -104,7 +105,7 @@ public function testReverseTransformWithDifferentTimezones()
$input = $output->format('U');
$output->setTimezone(new \DateTimeZone('Asia/Hong_Kong'));

$this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input));
$this->assertEquals($output, $reverseTransformer->reverseTransform($input));
}

public function testReverseTransformExpectsValidTimestamp()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testSubmitDateTime()

$dateTime = new \DateTime('2010-06-02 03:04:00 UTC');

$this->assertDateTimeEquals($dateTime, $form->getData());
$this->assertEquals($dateTime, $form->getData());
}

public function testSubmitString()
Expand Down Expand Up @@ -133,7 +133,7 @@ public function testSubmitWithoutMinutes()

$form->submit($input);

$this->assertDateTimeEquals(new \DateTime('2010-06-02 03:00:00 UTC'), $form->getData());
$this->assertEquals(new \DateTime('2010-06-02 03:00:00 UTC'), $form->getData());
}

public function testSubmitWithSeconds()
Expand Down Expand Up @@ -165,7 +165,7 @@ public function testSubmitWithSeconds()

$form->submit($input);

$this->assertDateTimeEquals(new \DateTime('2010-06-02 03:04:05 UTC'), $form->getData());
$this->assertEquals(new \DateTime('2010-06-02 03:04:05 UTC'), $form->getData());
}

public function testSubmitDifferentTimezones()
Expand Down Expand Up @@ -215,7 +215,7 @@ public function testSubmitDifferentTimezonesDateTime()

$outputTime->setTimezone(new \DateTimeZone('America/New_York'));

$this->assertDateTimeEquals($outputTime, $form->getData());
$this->assertEquals($outputTime, $form->getData());
$this->assertEquals('2010-06-02T03:04:00-10:00', $form->getViewData());
}

Expand Down Expand Up @@ -266,7 +266,7 @@ public function testSubmitDifferentPattern()
'time' => '03:04',
));

$this->assertDateTimeEquals($dateTime, $form->getData());
$this->assertEquals($dateTime, $form->getData());
}

public function testInitializeWithDateTime()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function testSubmitFromSingleTextDateTimeWithDefaultFormat()

$form->submit('2010-06-02');

$this->assertDateTimeEquals(new \DateTime('2010-06-02 UTC'), $form->getData());
$this->assertEquals(new \DateTime('2010-06-02 UTC'), $form->getData());
$this->assertEquals('2010-06-02', $form->getViewData());
}

Expand All @@ -80,7 +80,7 @@ public function testSubmitFromSingleTextDateTimeWithCustomFormat()

$form->submit('2010');

$this->assertDateTimeEquals(new \DateTime('2010-01-01 UTC'), $form->getData());
$this->assertEquals(new \DateTime('2010-01-01 UTC'), $form->getData());
$this->assertEquals('2010', $form->getViewData());
}

Expand All @@ -101,7 +101,7 @@ public function testSubmitFromSingleTextDateTime()

$form->submit('2.6.2010');

$this->assertDateTimeEquals(new \DateTime('2010-06-02 UTC'), $form->getData());
$this->assertEquals(new \DateTime('2010-06-02 UTC'), $form->getData());
$this->assertEquals('02.06.2010', $form->getViewData());
}

Expand Down Expand Up @@ -194,7 +194,7 @@ public function testSubmitFromText()

$dateTime = new \DateTime('2010-06-02 UTC');

$this->assertDateTimeEquals($dateTime, $form->getData());
$this->assertEquals($dateTime, $form->getData());
$this->assertEquals($text, $form->getViewData());
}

Expand All @@ -217,7 +217,7 @@ public function testSubmitFromChoice()

$dateTime = new \DateTime('2010-06-02 UTC');

$this->assertDateTimeEquals($dateTime, $form->getData());
$this->assertEquals($dateTime, $form->getData());
$this->assertEquals($text, $form->getViewData());
}

Expand Down Expand Up @@ -254,7 +254,7 @@ public function testSubmitFromInputDateTimeDifferentPattern()

$form->submit('06*2010*02');

$this->assertDateTimeEquals(new \DateTime('2010-06-02 UTC'), $form->getData());
$this->assertEquals(new \DateTime('2010-06-02 UTC'), $form->getData());
$this->assertEquals('06*2010*02', $form->getViewData());
}

Expand Down Expand Up @@ -468,7 +468,7 @@ public function testSetDataWithNegativeTimezoneOffsetDateTimeInput()

// 2010-06-02 00:00:00 UTC
// 2010-06-01 20:00:00 UTC-4
$this->assertDateTimeEquals($dateTime, $form->getData());
$this->assertEquals($dateTime, $form->getData());
$this->assertEquals('01.06.2010', $form->getViewData());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public function testSetDataDifferentTimezonesDateTime()
'second' => (int) $outputTime->format('s'),
);

$this->assertDateTimeEquals($dateTime, $form->getData());
$this->assertEquals($dateTime, $form->getData());
$this->assertEquals($displayedData, $form->getViewData());
}

Expand Down
0