generated from yii-tools/template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Date::class, Datetime::class, DatetimeLocal::class, Month::class,…
… Time::class widgets. (#171)
- Loading branch information
1 parent
348b00e
commit fc90d04
Showing
15 changed files
with
2,191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PHPForge\Html\Input; | ||
|
||
/** | ||
* The input element with a type attribute whose value is "date" represents a control for setting the element’s value to | ||
* a string representing a date. | ||
* | ||
* @link https://www.w3.org/TR/2012/WD-html-markup-20120329/input.date.html#input.date | ||
*/ | ||
final class Date extends Base\AbstractControl | ||
{ | ||
protected string $type = 'date'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PHPForge\Html\Input; | ||
|
||
/** | ||
* The input element with a type attribute whose value is "datetime" represents a control for setting the element’s | ||
* value to a string representing a global date and time (with timezone information). | ||
* | ||
* @link https://www.w3.org/TR/2012/WD-html-markup-20120329/input.datetime.html#input.datetime | ||
*/ | ||
final class Datetime extends Base\AbstractControl | ||
{ | ||
protected string $type = 'datetime'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PHPForge\Html\Input; | ||
|
||
/** | ||
* The input element with a type attribute whose value is "datetime-local" represents a control for setting the | ||
* element’s value to a string representing a local date and time (with no timezone information). | ||
* | ||
* @link https://www.w3.org/TR/2012/WD-html-markup-20120329/input.datetime-local.html#input.datetime-local | ||
*/ | ||
final class DatetimeLocal extends Base\AbstractControl | ||
{ | ||
protected string $type = 'datetime-local'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PHPForge\Html\Input; | ||
|
||
/** | ||
* The input element with a type attribute whose value is "month" represents a control for setting the element’s value | ||
* to a string representing a month. | ||
* | ||
* @link https://www.w3.org/TR/2012/WD-html-markup-20120329/input.month.html#input.month | ||
*/ | ||
final class Month extends Base\AbstractControl | ||
{ | ||
protected string $type = 'month'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PHPForge\Html\Input; | ||
|
||
/** | ||
* The input element with a type attribute whose value is "time" represents a control for setting the element’s value to | ||
* a string representing a time (with no timezone information). | ||
* | ||
* @link https://www.w3.org/TR/2012/WD-html-markup-20120329/input.time.html#input.time | ||
*/ | ||
final class Time extends Base\AbstractControl | ||
{ | ||
protected string $type = 'time'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PHPForge\Html\Tests\Input\Date; | ||
|
||
use InvalidArgumentException; | ||
use PHPForge\Html\Input\Date; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @psalm-suppress PropertyNotSetInConstructor | ||
*/ | ||
final class ExceptionTest extends TestCase | ||
{ | ||
public function testValue(): void | ||
{ | ||
$this->expectException(InvalidArgumentException::class); | ||
$this->expectExceptionMessage('Date::class widget must be a string or null value.'); | ||
|
||
Date::widget()->value([])->render(); | ||
} | ||
} |
Oops, something went wrong.