-
Notifications
You must be signed in to change notification settings - Fork 2
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
7 changed files
with
68 additions
and
12 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
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,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd "$(dirname "$0")"/.. | ||
|
||
vendor/bin/phpunit -c test "$@" |
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,26 @@ | ||
<?php | ||
namespace ScriptFUSIONTest\Porter\Provider\Iana; | ||
|
||
use ScriptFUSION\Porter\Collection\ProviderRecords; | ||
use ScriptFUSION\Porter\ImportSpecification; | ||
use ScriptFUSION\Porter\Provider\Iana\IanaPortNumbers; | ||
|
||
final class IanaPortNumbersTest extends IanaTest | ||
{ | ||
public function test() | ||
{ | ||
$records = $this->porter->import(new ImportSpecification(new IanaPortNumbers)); | ||
$this->assertInstanceOf(ProviderRecords::class, $records); | ||
|
||
foreach ($records as $record) { | ||
$this->assertTrue(isset($record['Service Name'][0]) || isset($record['Port Number'][0])); | ||
|
||
isset($record['Service Name'][0]) && | ||
$this->assertRegExp('[[\w-]+]', $record['Service Name']); | ||
isset($record['Port Number'][0]) && | ||
$this->assertRegExp('[\d+(?:-\d+)?]', $record['Port Number']); | ||
isset($record['Transport Protocol'][0]) && | ||
$this->assertContains($record['Transport Protocol'], ['tcp', 'udp', 'sctp', 'dccp']); | ||
} | ||
} | ||
} |
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,16 @@ | ||
<?php | ||
namespace ScriptFUSIONTest\Porter\Provider\Iana; | ||
|
||
use ScriptFUSION\Porter\Porter; | ||
use ScriptFUSION\Porter\Provider\Iana\IanaProvider; | ||
|
||
abstract class IanaTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** @var Porter */ | ||
protected $porter; | ||
|
||
protected function setUp() | ||
{ | ||
$this->porter = (new Porter)->addProvider(new IanaProvider); | ||
} | ||
} |
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,12 @@ | ||
<phpunit | ||
beStrictAboutOutputDuringTests="true" | ||
> | ||
<testsuite> | ||
<directory>.</directory> | ||
</testsuite> | ||
<filter> | ||
<whitelist processUncoveredFilesFromWhitelist="true"> | ||
<directory>../src</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |