Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Stanojevic committed Dec 27, 2020
1 parent 7181b77 commit 7bc102c
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions tests/TleModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
namespace App\Tests;

use Ivanstan\Tle\Helper\SampleTleHelper;
use Ivanstan\Tle\Model\Tle;
use PHPUnit\Framework\TestCase;
use ReflectionClass;

final class TleModelTest extends TestCase
{
Expand Down Expand Up @@ -44,7 +46,22 @@ public function testParse(): void
static::assertEquals(15.57860024, $tle->meanMotion(), 'Assert correct mean motion');
static::assertEquals(334.0891, $tle->raan(), 'Assert correct RAAN');
static::assertEquals(18321.21573649, $tle->epoch(), 'Assert correct epoch');
static::assertEquals('1 43550U 98067NY 18321.21573649 .00013513 00000-0 18402-3 0 9990', $tle->getLine1(), 'Assert correct first line');
static::assertEquals('2 43550 51.6389 334.0891 0005785 67.0956 293.0647 15.57860024 19804', $tle->getLine2(), 'Assert correct second line');
static::assertEquals(
'1 43550U 98067NY 18321.21573649 .00013513 00000-0 18402-3 0 9990',
$tle->getLine1(),
'Assert correct first line'
);
static::assertEquals(
'2 43550 51.6389 334.0891 0005785 67.0956 293.0647 15.57860024 19804',
$tle->getLine2(),
'Assert correct second line'
);

$class = new ReflectionClass(Tle::class);
$method = $class->getMethod('getLineByNumber');
$method->setAccessible(true);

$this->expectExceptionMessage('Invalid line number 3');
$method->invokeArgs($tle, [3]);
}
}

0 comments on commit 7bc102c

Please sign in to comment.