Skip to content

Commit

Permalink
fix: remove @ExpectedException annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
hussainweb committed Sep 24, 2022
1 parent 9cd72df commit e2a7d33
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion tests/Algorithm/GregorianAlgorithmTest.php
Expand Up @@ -3,6 +3,7 @@
namespace Hussainweb\DateConverter\Tests\Algorithm;

use Hussainweb\DateConverter\Algorithm\GregorianAlgorithm;
use Hussainweb\DateConverter\InvalidDateException;
use Hussainweb\DateConverter\Value\GregorianDate;
use PHPUnit\Framework\TestCase;

Expand Down Expand Up @@ -49,10 +50,10 @@ public function testToJulianDay($d, $m, $y, $jd)
/**
* @dataProvider invalidGregorianDateProvider
* @covers ::toJulianDay
* @expectedException \Hussainweb\DateConverter\InvalidDateException
*/
public function testInvalidToJulianDay($d, $m, $y)
{
$this->expectException(InvalidDateException::class);
$actual_jd = $this->algorithm->toJulianDay(new GregorianDate($d, $m, $y));
}

Expand Down
3 changes: 2 additions & 1 deletion tests/Algorithm/Hijri/HijriFatimidAstronomicalTest.php
Expand Up @@ -3,6 +3,7 @@
namespace Hussainweb\DateConverter\Tests\Algorithm\Hijri;

use Hussainweb\DateConverter\Algorithm\Hijri\HijriFatimidAstronomical;
use Hussainweb\DateConverter\InvalidDateException;
use Hussainweb\DateConverter\Value\HijriDate;
use PHPUnit\Framework\TestCase;

Expand Down Expand Up @@ -53,10 +54,10 @@ public function testToJulianDay($d, $m, $y, $jd)
* @dataProvider invalidHijriDateProvider
* @covers ::toJulianDay
* @covers ::getYearOffsetShift
* @expectedException \Hussainweb\DateConverter\InvalidDateException
*/
public function testInvalidToJulianDay($d, $m, $y)
{
$this->expectException(InvalidDateException::class);
$actual_jd = $this->algorithm->toJulianDay(new HijriDate($d, $m, $y, $this->algorithm));
}

Expand Down
5 changes: 3 additions & 2 deletions tests/Algorithm/NativeAlgorithmTest.php
Expand Up @@ -3,6 +3,7 @@
namespace Hussainweb\DateConverter\Tests\Algorithm;

use Hussainweb\DateConverter\Algorithm\NativeAlgorithm;
use Hussainweb\DateConverter\InvalidDateException;
use Hussainweb\DateConverter\Value\GregorianDate;
use Hussainweb\DateConverter\Value\NativeDate;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -51,10 +52,10 @@ public function testToJulianDay($ts, $d, $m, $y, $jd)
/**
* @dataProvider nativeDateProvider
* @covers ::toJulianDay
* @expectedException \InvalidArgumentException
*/
public function testOtherToJulianDay($ts, $d, $m, $y, $jd)
{
$this->expectException(InvalidDateException::class);
$actual_jd = $this->algorithm->toJulianDay(new GregorianDate($d, $m, $y));
}

Expand All @@ -78,10 +79,10 @@ public function testIsValidDateInvalid($d, $m, $y)

/**
* @covers \Hussainweb\DateConverter\Algorithm\NativeAlgorithm::getMonthDays
* @expectedException \InvalidArgumentException
*/
public function testExceptionOnGetMonthDays()
{
$this->expectException(InvalidDateException::class);
$days = $this->algorithm->getMonthDays(2017, 1);
}

Expand Down
3 changes: 2 additions & 1 deletion tests/Value/GregorianDateTest.php
Expand Up @@ -3,6 +3,7 @@
namespace Hussainweb\DateConverter\Tests\Value;

use Hussainweb\DateConverter\Formatter\GregorianDateFormatter;
use Hussainweb\DateConverter\InvalidDateException;
use Hussainweb\DateConverter\Value\GregorianDate;
use PHPUnit\Framework\TestCase;

Expand Down Expand Up @@ -45,10 +46,10 @@ public function testGregorianDatesDateTime($d, $m, $y)
/**
* @dataProvider invalidGregorianDateProvider
* @covers ::__construct
* @expectedException \Hussainweb\DateConverter\InvalidDateException
*/
public function testInvalidGregorianDates($d, $m, $y)
{
$this->expectException(InvalidDateException::class);
$gregorian_date = new GregorianDate($d, $m, $y);
}

Expand Down
5 changes: 3 additions & 2 deletions tests/Value/HijriDateTest.php
Expand Up @@ -4,6 +4,7 @@

use Hussainweb\DateConverter\Formatter\HijriDateFormatter;
use Hussainweb\DateConverter\Algorithm\Hijri\HijriAlgorithmBase;
use Hussainweb\DateConverter\InvalidDateException;
use Hussainweb\DateConverter\Value\HijriDate;
use PHPUnit\Framework\TestCase;

Expand Down Expand Up @@ -44,11 +45,11 @@ public function testHijriDates($d, $m, $y)
* @dataProvider invalidHijriDateProvider
* @covers ::__construct
* @covers \Hussainweb\DateConverter\Algorithm\Hijri\HijriAlgorithmBase::isValidDate
* @expectedException \Hussainweb\DateConverter\InvalidDateException
*/
public function testInvalidHijriDates($d, $m, $y)
{
$hijri_date = new HijriDate($d, $m, $y, $this->algorithm);
$this->expectException(InvalidDateException::class);
$hijri_date = new HijriDate($d, $m, $y, $this->algorithm);
}

/**
Expand Down

0 comments on commit e2a7d33

Please sign in to comment.