8000 [Form] debug failures on AppVeyor by xabbuh · Pull Request #52251 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] debug failures on AppVeyor #52251

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

Closed
wants to merge 1 commit into from
Closed
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
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ public function reverseTransform(mixed $value): ?\DateTime
}

if (0 != intl_get_error_code()) {
var_dump($value);
var_dump($this->dateFormat);
var_dump($this->timeFormat);
var_dump($this->calendar);
var_dump($this->pattern);
var_dump(\Locale::getDefault());

throw new TransformationFailedException(intl_get_error_message(), intl_get_error_code());
} elseif ($timestamp > 253402214400) {
// This timestamp represents UTC midnight of 9999-12-31 to prevent 5+ digit years
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Intl\Intl;
use Symfony\Component\Intl\Util\IntlTestHelper;
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;

Expand Down Expand Up @@ -92,7 +93,7 @@ public function testSubmitFromSingleTextDateTimeWithCustomFormat()
public function testSubmitFromSingleTextDateTime()
{
// we test against "de_DE", so we need the full implementation
IntlTestHelper::requireFullIntl($this, false);
IntlTestHelper::requireFullIntl($this, false, true);

\Locale::setDefault('de_DE');

Expand All @@ -106,6 +107,18 @@ public function testSubmitFromSingleTextDateTime()
]);

$form->submit('2.6.2010');
var_dump(__METHOD__);
var_dump(Intl::getIcuVersion());

if (!$form->isValid()) {
/** @var FormError $error */
foreach ($form->getErrors(true) as $error) {
var_dump($error->getMessage());
var_dump($error->getCause()->getMessage());
var_dump($error->getCause()->getInvalidMessage());
var_dump($error->getCause()->getInvalidMessageParameters());
}
}

$this->assertEquals(new \DateTime('2010-06-02 UTC'), $form->getData());
$this->assertEquals('02.06.2010', $form->getViewData());
Expand Down
17 changes: 14 additions & 3 deletions src/Symfony/Component/Intl/Util/IntlTestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@ class IntlTestHelper
*
* @return void
*/
public static function requireIntl(TestCase $testCase, string $minimumIcuVersion = null)
public static function requireIntl(TestCase $testCase, string $minimumIcuVersion = null, bool $debug = false)
{
if ($debug) {
var_dump(__METHOD__);
var_dump($minimumIcuVersion);
925B }
$minimumIcuVersion ??= Intl::getIcuStubVersion();
if ($debug) {
var_dump($minimumIcuVersion);
}

// We only run tests if the version is *one specific version*.
// This condition is satisfied if
Expand Down Expand Up @@ -66,14 +73,18 @@ public static function requireIntl(TestCase $testCase, string $minimumIcuVersion
*
* @return void
*/
public static function requireFullIntl(TestCase $testCase, string $minimumIcuVersion = null)
public static function requireFullIntl(TestCase $testCase, string $minimumIcuVersion = null, bool $debug = false)
{
if ($debug) {
var_dump(__METHOD__);
var_dump($minimumIcuVersion);
}
// We only run tests if the intl extension is loaded...
if (!Intl::isExtensionLoaded()) {
$testCase->markTestSkipped('Extension intl is required.');
}

self::requireIntl($testCase, $minimumIcuVersion);
self::requireIntl($testCase, $minimumIcuVersion, $debug);

// Consequently, tests will
//
Expand Down
0