Skip to content

Commit

Permalink
Merge pull request #2 from salamwaddah/pest-tests
Browse files Browse the repository at this point in the history
initial pest tests #1
  • Loading branch information
salamwaddah committed Jan 28, 2024
2 parents 5f8444e + 1bcc555 commit 1d35890
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
18 changes: 15 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
],
"autoload": {
"psr-4": {
"SalamWaddah\\PassportVisa\\": "src/"
"SalamWaddah\\PassportVisa\\": "src/",
"SalamWaddah\\PassportVisa\\Tests\\": "tests/"
}
},
"require": {
Expand All @@ -27,5 +28,16 @@
"guzzlehttp/guzzle": "^7.8"
},
"minimum-stability": "stable",
"version": "1.0.0"
}
"version": "1.0.0",
"require-dev": {
"pestphp/pest": "^2.33"
},
"scripts": {
"test": "vendor/bin/pest"
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
}
}
18 changes: 18 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./app</directory>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
7 changes: 6 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,9 @@ $passport->listNotAdmitted(); // returns []

## Caching

This library does not cache the results, you can use your own caching mechanism to avoid unnecessarily calling passportindex.org everytime. A recommended TTL for your cache is 1 day.
This library does not cache the results, you can use your own caching mechanism to avoid unnecessarily calling passportindex.org everytime. A recommended TTL for your cache is 1 day.

## Testing
```bash
composer test
```
14 changes: 14 additions & 0 deletions tests/PassportTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

use SalamWaddah\PassportVisa\Passport;


describe('supported countries', function () {
it('valid country code', function () {
expect(Passport::isSupported('ma'))->toBeTrue();
});

it('invalid country code', function () {
expect(Passport::isSupported('zzz'))->toBeFalse();
});
});

0 comments on commit 1d35890

Please sign in to comment.