-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
747 additions
and
2 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,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Brick\DateTime\Tests\Field; | ||
|
||
use Brick\DateTime\Field\DayOfMonth; | ||
use Brick\DateTime\Tests\AbstractTestCase; | ||
|
||
/** | ||
* Unit tests for class DayOfMonth. | ||
*/ | ||
class DayOfMonthTest extends AbstractTestCase | ||
{ | ||
/** | ||
* @doesNotPerformAssertions | ||
*/ | ||
public function testCheckWithNullMonthOfYear() | ||
{ | ||
DayOfMonth::check(31); | ||
} | ||
} |
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,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Brick\DateTime\Tests\Field; | ||
|
||
use Brick\DateTime\Field\WeekOfYear; | ||
use Brick\DateTime\Tests\AbstractTestCase; | ||
|
||
/** | ||
* Unit tests for class WeekOfYear. | ||
*/ | ||
class WeekOfYearTest extends AbstractTestCase | ||
{ | ||
/** | ||
* @expectedException \Brick\DateTime\DateTimeException | ||
* @expectedExceptionMessage Invalid week-of-year: -1 is not in the range 1 to 53. | ||
*/ | ||
public function testCheckShouldThrowDateTimeExceptionWithFieldNotInRange() | ||
{ | ||
WeekOfYear::check(-1); | ||
} | ||
|
||
/** | ||
* @expectedException \Brick\DateTime\DateTimeException | ||
* @expectedExceptionMessage Year 2000 does not have 53 weeks | ||
*/ | ||
public function testCheckShouldThrowDateTimeExceptionWith52WeekYear() | ||
{ | ||
WeekOfYear::check(53, 2000); | ||
} | ||
} |
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
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
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
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,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Brick\DateTime\Tests\Parser; | ||
|
||
use Brick\DateTime\Parser\DateTimeParseResult; | ||
use Brick\DateTime\Tests\AbstractTestCase; | ||
|
||
/** | ||
* Unit tests for class DateTimeParseResult. | ||
*/ | ||
class DateTimeParseResultTest extends AbstractTestCase | ||
{ | ||
/** | ||
* @expectedException \Brick\DateTime\Parser\DateTimeParseException | ||
* @expectedExceptionMessage Field invalid_field_name is not present in the parsed result. | ||
*/ | ||
public function testGetFieldWithInvalidFieldStringName() | ||
{ | ||
$dateTimeParseResult = new DateTimeParseResult(); | ||
$dateTimeParseResult->getField('invalid_field_name'); | ||
} | ||
} |
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,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Brick\DateTime\Tests\Parser; | ||
|
||
use Brick\DateTime\Parser\PatternParserBuilder; | ||
use Brick\DateTime\Tests\AbstractTestCase; | ||
|
||
/** | ||
* Unit tests for class PatternParserBuilder. | ||
*/ | ||
class PatternParserBuilderTest extends AbstractTestCase | ||
{ | ||
/** | ||
* @expectedException \RuntimeException | ||
* @expectedExceptionMessage Cannot call endOptional() without a call to startOptional() first. | ||
*/ | ||
public function testEndOptionalShouldThrowRuntimeException() | ||
{ | ||
$patternParserBuilder = new PatternParserBuilder(); | ||
$patternParserBuilder->endOptional(); | ||
} | ||
|
||
/** | ||
* @expectedException \RuntimeException | ||
* @expectedExceptionMessage Cannot call endGroup() without a call to startGroup() first. | ||
*/ | ||
public function testEndGroupShouldThrowRuntimeException() | ||
{ | ||
$patternParserBuilder = new PatternParserBuilder(); | ||
$patternParserBuilder->endGroup(); | ||
} | ||
|
||
/** | ||
* @expectedException \RuntimeException | ||
* @expectedExceptionMessage Builder misses call to endOptional() or endGroup(). | ||
*/ | ||
public function testToParserWithNonEmptyStack() | ||
{ | ||
$patternParserBuilder = new PatternParserBuilder(); | ||
$patternParserBuilder->startGroup(); | ||
$patternParserBuilder->toParser(); | ||
} | ||
} |
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
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
Oops, something went wrong.