Issue #2316153 by Berdir: Fixed PHP 5.4.30/5.5.15+ changed json_encode() of DateTime objects to include microseconds, breaks tests.

8.0.x
webchick 2014-08-05 21:55:48 -07:00
parent 022163f539
commit eda0bc578e
1 changed files with 5 additions and 1 deletions

View File

@ -128,7 +128,11 @@ class FormTestDisabledElementsForm extends FormBase {
// Date.
$date = new DrupalDateTime('1978-11-01 10:30:00', 'Europe/Berlin');
$expected = array('date' => '1978-11-01 10:30:00', 'timezone_type' => 3, 'timezone' => 'Europe/Berlin',);
// Starting with PHP 5.4.30, 5.5.15, JSON encoded DateTime objects include
// microsends. Make sure that the expected value is correct for all versions
// by encoding and decoding it again instead of hardcoding it.
// See https://github.com/php/php-src/commit/fdb2709dd27c5987c2d2c8aaf0cdbebf9f17f643
$expected = json_decode(json_encode($date), TRUE);
$form['disabled_container']['disabled_container_datetime'] = array(
'#type' => 'datetime',
'#title' => 'datetime',