/**
  * The subscriber creates the timestamp from the widget value.
  *
  * @param string $format The given date format.
  * @param string $value  The given date example
  *
  * @dataProvider dataProvider
  * @test
  */
 public function it_creates_timestamp_from_widget_value($format, $value)
 {
     $dateTime = \DateTime::createFromFormat($format, $value);
     $timestamp = $dateTime->getTimestamp();
     $attribute = $this->mockAttribute($format);
     $attribute->expects($this->any())->method('widgetToValue')->will($this->returnValue($timestamp));
     $model = $this->mockModelWithAttribute($attribute);
     $event = new DecodePropertyValueForWidgetEvent($this->mockEnvironment(), $model);
     $event->setProperty('date');
     $event->setValue($timestamp);
     $this->eventDispatcher->expects($this->atLeastOnce())->method('dispatch')->with($this->anything(), $this->callback(function (ParseDateEvent $event) use($value) {
         $event->setResult($value);
         return true;
     }));
     $this->backendSubscriber->handleDecodePropertyValueForWidgetEvent($event);
     $this->assertEquals($value, $event->getValue());
 }