|
@@ -45,12 +45,12 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
));
|
|
|
}
|
|
|
|
|
|
- public function testSubmitFromInputDateTime()
|
|
|
+ public function testSubmitFromSingleTextDateTime()
|
|
|
{
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
'data_timezone' => 'UTC',
|
|
|
'user_timezone' => 'UTC',
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
'input' => 'datetime',
|
|
|
));
|
|
|
|
|
@@ -60,12 +60,12 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
$this->assertEquals('02.06.2010', $form->getClientData());
|
|
|
}
|
|
|
|
|
|
- public function testSubmitFromInputString()
|
|
|
+ public function testSubmitFromSingleTextString()
|
|
|
{
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
'data_timezone' => 'UTC',
|
|
|
'user_timezone' => 'UTC',
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
'input' => 'string',
|
|
|
));
|
|
|
|
|
@@ -75,12 +75,12 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
$this->assertEquals('02.06.2010', $form->getClientData());
|
|
|
}
|
|
|
|
|
|
- public function testSubmitFromInputTimestamp()
|
|
|
+ public function testSubmitFromSingleTextTimestamp()
|
|
|
{
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
'data_timezone' => 'UTC',
|
|
|
'user_timezone' => 'UTC',
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
'input' => 'timestamp',
|
|
|
));
|
|
|
|
|
@@ -92,12 +92,12 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
$this->assertEquals('02.06.2010', $form->getClientData());
|
|
|
}
|
|
|
|
|
|
- public function testSubmitFromInputRaw()
|
|
|
+ public function testSubmitFromSingleTextRaw()
|
|
|
{
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
'data_timezone' => 'UTC',
|
|
|
'user_timezone' => 'UTC',
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
'input' => 'array',
|
|
|
));
|
|
|
|
|
@@ -113,6 +113,28 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
$this->assertEquals('02.06.2010', $form->getClientData());
|
|
|
}
|
|
|
|
|
|
+ public function testSubmitFromText()
|
|
|
+ {
|
|
|
+ $form = $this->factory->create('date', null, array(
|
|
|
+ 'data_timezone' => 'UTC',
|
|
|
+ 'user_timezone' => 'UTC',
|
|
|
+ 'widget' => 'text',
|
|
|
+ ));
|
|
|
+
|
|
|
+ $text = array(
|
|
|
+ 'day' => '2',
|
|
|
+ 'month' => '6',
|
|
|
+ 'year' => '2010',
|
|
|
+ );
|
|
|
+
|
|
|
+ $form->bind($text);
|
|
|
+
|
|
|
+ $dateTime = new \DateTime('2010-06-02 UTC');
|
|
|
+
|
|
|
+ $this->assertDateTimeEquals($dateTime, $form->getData());
|
|
|
+ $this->assertEquals($text, $form->getClientData());
|
|
|
+ }
|
|
|
+
|
|
|
public function testSubmitFromChoice()
|
|
|
{
|
|
|
$form = $this->factory->create('date', null, array(
|
|
@@ -163,7 +185,7 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
'user_timezone' => 'Pacific/Tahiti',
|
|
|
// don't do this test with DateTime, because it leads to wrong results!
|
|
|
'input' => 'string',
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
));
|
|
|
|
|
|
$form->setData('2010-06-02');
|
|
@@ -178,7 +200,7 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
'data_timezone' => 'UTC',
|
|
|
'user_timezone' => 'UTC',
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
'years' => array(2010, 2011),
|
|
|
));
|
|
|
|
|
@@ -194,7 +216,7 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
'data_timezone' => 'UTC',
|
|
|
'user_timezone' => 'UTC',
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
'years' => array(2010, 2011),
|
|
|
));
|
|
|
|
|
@@ -230,7 +252,7 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
'data_timezone' => 'UTC',
|
|
|
'user_timezone' => 'UTC',
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
'years' => array(2010, 2012),
|
|
|
));
|
|
|
|
|
@@ -246,7 +268,7 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
'data_timezone' => 'UTC',
|
|
|
'user_timezone' => 'UTC',
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
'months' => array(6, 7),
|
|
|
));
|
|
|
|
|
@@ -262,7 +284,7 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
'data_timezone' => 'UTC',
|
|
|
'user_timezone' => 'UTC',
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
'months' => array(6, 7),
|
|
|
));
|
|
|
|
|
@@ -298,7 +320,7 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
'data_timezone' => 'UTC',
|
|
|
'user_timezone' => 'UTC',
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
'months' => array(6, 8),
|
|
|
));
|
|
|
|
|
@@ -314,7 +336,7 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
'data_timezone' => 'UTC',
|
|
|
'user_timezone' => 'UTC',
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
'days' => array(6, 7),
|
|
|
));
|
|
|
|
|
@@ -330,7 +352,7 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
'data_timezone' => 'UTC',
|
|
|
'user_timezone' => 'UTC',
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
'days' => array(6, 7),
|
|
|
));
|
|
|
|
|
@@ -368,7 +390,7 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
'data_timezone' => 'UTC',
|
|
|
'user_timezone' => 'UTC',
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
'days' => array(6, 8),
|
|
|
));
|
|
|
|
|
@@ -377,14 +399,14 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
$this->assertFalse($form->isDayWithinRange());
|
|
|
}
|
|
|
|
|
|
- public function testIsPartiallyFilledReturnsFalseIfInput()
|
|
|
+ public function testIsPartiallyFilledReturnsFalseIfSingleText()
|
|
|
{
|
|
|
$this->markTestIncomplete('Needs to be reimplemented using validators');
|
|
|
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
'data_timezone' => 'UTC',
|
|
|
'user_timezone' => 'UTC',
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
));
|
|
|
|
|
|
$form->bind('7.6.2010');
|
|
@@ -460,7 +482,7 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
public function testDontPassDatePatternIfText()
|
|
|
{
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
));
|
|
|
$view = $form->createView();
|
|
|
|
|
@@ -470,10 +492,10 @@ class DateTypeTest extends LocalizedTestCase
|
|
|
public function testPassWidgetToView()
|
|
|
{
|
|
|
$form = $this->factory->create('date', null, array(
|
|
|
- 'widget' => 'text',
|
|
|
+ 'widget' => 'single-text',
|
|
|
));
|
|
|
$view = $form->createView();
|
|
|
|
|
|
- $this->assertSame('text', $view->get('widget'));
|
|
|
+ $this->assertSame('single-text', $view->get('widget'));
|
|
|
}
|
|
|
}
|