"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "public_html/lists/base/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php" between
phplist-3.4.5.tgz and phplist-3.4.6.tgz

About: phpList is a one-way email announcement delivery system for newsletters, publicity lists, notifications, and many other uses (requires PHP and MySQL).

DateTypeTest.php  (phplist-3.4.5.tgz):DateTypeTest.php  (phplist-3.4.6.tgz)
skipping to change at line 38 skipping to change at line 38
$this->defaultTimezone = date_default_timezone_get(); $this->defaultTimezone = date_default_timezone_get();
$this->defaultLocale = \Locale::getDefault(); $this->defaultLocale = \Locale::getDefault();
} }
protected function tearDown() protected function tearDown()
{ {
date_default_timezone_set($this->defaultTimezone); date_default_timezone_set($this->defaultTimezone);
\Locale::setDefault($this->defaultLocale); \Locale::setDefault($this->defaultLocale);
} }
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOp
tionsException
*/
public function testInvalidWidgetOption() public function testInvalidWidgetOption()
{ {
$this->expectException('Symfony\Component\OptionsResolver\Exception\Inva lidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [ $this->factory->create(static::TESTED_TYPE, null, [
'widget' => 'fake_widget', 'widget' => 'fake_widget',
]); ]);
} }
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOp
tionsException
*/
public function testInvalidInputOption() public function testInvalidInputOption()
{ {
$this->expectException('Symfony\Component\OptionsResolver\Exception\Inva lidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [ $this->factory->create(static::TESTED_TYPE, null, [
'input' => 'fake_input', 'input' => 'fake_input',
]); ]);
} }
public function testSubmitFromSingleTextDateTimeWithDefaultFormat() public function testSubmitFromSingleTextDateTimeWithDefaultFormat()
{ {
$form = $this->factory->create(static::TESTED_TYPE, null, [ $form = $this->factory->create(static::TESTED_TYPE, null, [
'model_timezone' => 'UTC', 'model_timezone' => 'UTC',
'view_timezone' => 'UTC', 'view_timezone' => 'UTC',
skipping to change at line 344 skipping to change at line 340
return [ return [
['dMy', '{{ day }}{{ month }}{{ year }}'], ['dMy', '{{ day }}{{ month }}{{ year }}'],
['d-M-yyyy', '{{ day }}-{{ month }}-{{ year }}'], ['d-M-yyyy', '{{ day }}-{{ month }}-{{ year }}'],
['M d y', '{{ month }} {{ day }} {{ year }}'], ['M d y', '{{ month }} {{ day }} {{ year }}'],
]; ];
} }
/** /**
* This test is to check that the strings '0', '1', '2', '3' are not accepte d * This test is to check that the strings '0', '1', '2', '3' are not accepte d
* as valid IntlDateFormatter constants for FULL, LONG, MEDIUM or SHORT resp ectively. * as valid IntlDateFormatter constants for FULL, LONG, MEDIUM or SHORT resp ectively.
*
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOp
tionsException
*/ */
public function testThrowExceptionIfFormatIsNoPattern() public function testThrowExceptionIfFormatIsNoPattern()
{ {
$this->expectException('Symfony\Component\OptionsResolver\Exception\Inva lidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [ $this->factory->create(static::TESTED_TYPE, null, [
'format' => '0', 'format' => '0',
'widget' => 'single_text', 'widget' => 'single_text',
'input' => 'string', 'input' => 'string',
]); ]);
} }
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOp
tionsException
* @expectedExceptionMessage The "format" option should contain the letters
"y", "M" and "d". Its current value is "yy".
*/
public function testThrowExceptionIfFormatDoesNotContainYearMonthAndDay() public function testThrowExceptionIfFormatDoesNotContainYearMonthAndDay()
{ {
$this->expectException('Symfony\Component\OptionsResolver\Exception\Inva
lidOptionsException');
$this->expectExceptionMessage('The "format" option should contain the le
tters "y", "M" and "d". Its current value is "yy".');
$this->factory->create(static::TESTED_TYPE, null, [ $this->factory->create(static::TESTED_TYPE, null, [
'months' => [6, 7], 'months' => [6, 7],
'format' => 'yy', 'format' => 'yy',
]); ]);
} }
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOp
tionsException
* @expectedExceptionMessage The "format" option should contain the letters
"y", "M" or "d". Its current value is "wrong".
*/
public function testThrowExceptionIfFormatMissesYearMonthAndDayWithSingleTex tWidget() public function testThrowExceptionIfFormatMissesYearMonthAndDayWithSingleTex tWidget()
{ {
$this->expectException('Symfony\Component\OptionsResolver\Exception\Inva
lidOptionsException');
$this->expectExceptionMessage('The "format" option should contain the le
tters "y", "M" or "d". Its current value is "wrong".');
$this->factory->create(static::TESTED_TYPE, null, [ $this->factory->create(static::TESTED_TYPE, null, [
'widget' => 'single_text', 'widget' => 'single_text',
'format' => 'wrong', 'format' => 'wrong',
]); ]);
} }
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOp
tionsException
*/
public function testThrowExceptionIfFormatIsNoConstant() public function testThrowExceptionIfFormatIsNoConstant()
{ {
$this->expectException('Symfony\Component\OptionsResolver\Exception\Inva lidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [ $this->factory->create(static::TESTED_TYPE, null, [
'format' => 105, 'format' => 105,
]); ]);
} }
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOp
tionsException
*/
public function testThrowExceptionIfFormatIsInvalid() public function testThrowExceptionIfFormatIsInvalid()
{ {
$this->expectException('Symfony\Component\OptionsResolver\Exception\Inva lidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [ $this->factory->create(static::TESTED_TYPE, null, [
'format' => [], 'format' => [],
]); ]);
} }
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOp
tionsException
*/
public function testThrowExceptionIfYearsIsInvalid() public function testThrowExceptionIfYearsIsInvalid()
{ {
$this->expectException('Symfony\Component\OptionsResolver\Exception\Inva lidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [ $this->factory->create(static::TESTED_TYPE, null, [
'years' => 'bad value', 'years' => 'bad value',
]); ]);
} }
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOp
tionsException
*/
public function testThrowExceptionIfMonthsIsInvalid() public function testThrowExceptionIfMonthsIsInvalid()
{ {
$this->expectException('Symfony\Component\OptionsResolver\Exception\Inva lidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [ $this->factory->create(static::TESTED_TYPE, null, [
'months' => 'bad value', 'months' => 'bad value',
]); ]);
} }
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOp
tionsException
*/
public function testThrowExceptionIfDaysIsInvalid() public function testThrowExceptionIfDaysIsInvalid()
{ {
$this->expectException('Symfony\Component\OptionsResolver\Exception\Inva lidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, [ $this->factory->create(static::TESTED_TYPE, null, [
'days' => 'bad value', 'days' => 'bad value',
]); ]);
} }
public function testSetDataWithNegativeTimezoneOffsetStringInput() public function testSetDataWithNegativeTimezoneOffsetStringInput()
{ {
// we test against "de_DE", so we need the full implementation // we test against "de_DE", so we need the full implementation
IntlTestHelper::requireFullIntl($this, false); IntlTestHelper::requireFullIntl($this, false);
skipping to change at line 493 skipping to change at line 474
$view = $form->createView(); $view = $form->createView();
$this->assertEquals([ $this->assertEquals([
new ChoiceView('2010', '2010', '2010'), new ChoiceView('2010', '2010', '2010'),
new ChoiceView('2011', '2011', '2011'), new ChoiceView('2011', '2011', '2011'),
], $view['year']->vars['choices']); ], $view['year']->vars['choices']);
} }
public function testMonthsOption() public function testMonthsOption()
{ {
\Locale::setDefault('en');
$form = $this->factory->create(static::TESTED_TYPE, null, [ $form = $this->factory->create(static::TESTED_TYPE, null, [
'months' => [6, 7], 'months' => [6, 7],
'format' => \IntlDateFormatter::SHORT, 'format' => \IntlDateFormatter::SHORT,
]); ]);
$view = $form->createView(); $view = $form->createView();
$this->assertEquals([ $this->assertEquals([
new ChoiceView(6, '6', '06'), new ChoiceView(6, '6', '6'),
new ChoiceView(7, '7', '07'), new ChoiceView(7, '7', '7'),
], $view['month']->vars['choices']); ], $view['month']->vars['choices']);
} }
public function testMonthsOptionShortFormat() public function testMonthsOptionShortFormat()
{ {
// we test against "de_AT", so we need the full implementation // we test against "de_AT", so we need the full implementation
IntlTestHelper::requireFullIntl($this, '57.1'); IntlTestHelper::requireFullIntl($this, '57.1');
\Locale::setDefault('de_AT'); \Locale::setDefault('de_AT');
skipping to change at line 566 skipping to change at line 548
->createView(); ->createView();
$this->assertEquals([ $this->assertEquals([
new ChoiceView(1, '1', 'Jänner'), new ChoiceView(1, '1', 'Jänner'),
new ChoiceView(4, '4', 'April'), new ChoiceView(4, '4', 'April'),
], $view['month']->vars['choices']); ], $view['month']->vars['choices']);
} }
public function testIsDayWithinRangeReturnsTrueIfWithin() public function testIsDayWithinRangeReturnsTrueIfWithin()
{ {
\Locale::setDefault('en');
$view = $this->factory->create(static::TESTED_TYPE, null, [ $view = $this->factory->create(static::TESTED_TYPE, null, [
'days' => [6, 7], 'days' => [6, 7],
]) ])
->createView(); ->createView();
$this->assertEquals([ $this->assertEquals([
new ChoiceView(6, '6', '06'), new ChoiceView(6, '6', '6'),
new ChoiceView(7, '7', '07'), new ChoiceView(7, '7', '7'),
], $view['day']->vars['choices']); ], $view['day']->vars['choices']);
} }
public function testIsSynchronizedReturnsTrueIfChoiceAndCompletelyEmpty() public function testIsSynchronizedReturnsTrueIfChoiceAndCompletelyEmpty()
{ {
$form = $this->factory->create(static::TESTED_TYPE, null, [ $form = $this->factory->create(static::TESTED_TYPE, null, [
'model_timezone' => 'UTC', 'model_timezone' => 'UTC',
'view_timezone' => 'UTC', 'view_timezone' => 'UTC',
'widget' => 'choice', 'widget' => 'choice',
]); ]);
 End of changes. 24 change blocks. 
47 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)