| 1 | <?php |
||
| 13 | abstract class DatePickerBase |
||
| 14 | { |
||
| 15 | use Debugger; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var RawTqContext |
||
| 19 | */ |
||
| 20 | protected $context; |
||
| 21 | /** |
||
| 22 | * @var NodeElement |
||
| 23 | */ |
||
| 24 | protected $element; |
||
| 25 | /** |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $date = ''; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param RawTqContext $context |
||
| 32 | * Behat context. |
||
| 33 | * @param string $selector |
||
| 34 | * Element selector. |
||
| 35 | * @param string $date |
||
| 36 | * Human-readable date. |
||
| 37 | */ |
||
| 38 | public function __construct(RawTqContext $context, $selector, $date) |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @param string $javascript |
||
| 47 | * JS code for execution. |
||
| 48 | * |
||
| 49 | * @return mixed |
||
| 50 | * Result of JS execution. |
||
| 51 | */ |
||
| 52 | protected function execute($javascript) |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @param string $date |
||
| 59 | * The string to parse. |
||
| 60 | * |
||
| 61 | * @return string |
||
| 62 | */ |
||
| 63 | protected static function jsDate($date) |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @throws \Exception |
||
| 70 | * When date is not available for selection. |
||
| 71 | * |
||
| 72 | * @return static |
||
| 73 | */ |
||
| 74 | abstract public function isDateAvailable(); |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @return static |
||
| 78 | */ |
||
| 79 | abstract public function setDate(); |
||
| 80 | |||
| 81 | /** |
||
| 82 | * @throws \Exception |
||
| 83 | * When date is not selected. |
||
| 84 | * |
||
| 85 | * @return static |
||
| 86 | */ |
||
| 87 | abstract public function isDateSelected(); |
||
| 88 | } |
||
| 89 |