Skip to content
This repository has been archived by the owner on Nov 15, 2020. It is now read-only.

Commit

Permalink
Fixed compatibility with Nette 2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed Jul 8, 2016
1 parent f9b1cad commit d3890aa
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Nella/Forms/DateTime/DateInput.php
Expand Up @@ -169,12 +169,12 @@ private function normalizeFormat($input)
}

/**
* @param string $message
* @param string|bool $message
* @return \Nella\Forms\DateTime\DateInput
*/
public function setRequired($message = TRUE)
{
if (!is_string($message)) {
if (!is_bool($message) && !is_string($message)) {
throw new \Nette\InvalidArgumentException('Message must be string');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Nella/Forms/DateTime/DateTimeInput.php
Expand Up @@ -322,7 +322,7 @@ private function normalizeFormat($input)
*/
public function setRequired($message = TRUE)
{
if (!is_string($message)) {
if (!is_bool($message) && !is_string($message)) {
throw new \Nette\InvalidArgumentException('Message must be string');
}

Expand Down
18 changes: 17 additions & 1 deletion tests/Nella/Forms/DateTime/DateInputTest.phpt
Expand Up @@ -257,7 +257,23 @@ class DateInputTest extends \Tester\TestCase
{
$control = $this->createControl();

$control->setRequired();
$control->setRequired([]);
}

public function testRequired()
{
$control = $this->createControl();

$control->setRequired(TRUE);
Assert::true($control->isRequired());
}

public function testOptional()
{
$control = $this->createControl();

$control->setRequired(FALSE);
Assert::false($control->isRequired());
}

/**
Expand Down
18 changes: 17 additions & 1 deletion tests/Nella/Forms/DateTime/DateTimeInputTest.phpt
Expand Up @@ -503,7 +503,23 @@ class DateTimeInputTest extends \Tester\TestCase
{
$control = $this->createControl();

$control->setRequired();
$control->setRequired([]);
}

public function testRequired()
{
$control = $this->createControl();

$control->setRequired(TRUE);
Assert::true($control->isRequired());
}

public function testOptional()
{
$control = $this->createControl();

$control->setRequired(FALSE);
Assert::false($control->isRequired());
}

/**
Expand Down

0 comments on commit d3890aa

Please sign in to comment.