Merge pull request #3 from open-source-contributions/migrate_github_action
Replace Travis CI with GitHub Actions
This commit is contained in:
commit
5221ca9df6
7 changed files with 120 additions and 95 deletions
|
@ -1 +0,0 @@
|
||||||
service_name: travis-ci
|
|
29
.github/workflows/test.yml
vendored
Normal file
29
.github/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
name: Test
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: Test PHP ${{ matrix.php-version }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
php-version: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-version }}
|
||||||
|
- name: PHP Version
|
||||||
|
run: php --version
|
||||||
|
- name: Composer Version
|
||||||
|
run: composer --version
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: COMPOSER_MEMORY_LIMIT=-1 composer install
|
||||||
|
- name: Run Tests
|
||||||
|
run: vendor/bin/phpunit --coverage-clover ./coverage.xml
|
||||||
|
- name: Upload Coverage
|
||||||
|
if: ${{ matrix.php-version == '7.4' }}
|
||||||
|
uses: codecov/codecov-action@v1
|
||||||
|
with:
|
||||||
|
file: ./coverage.xml
|
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
composer.lock
|
||||||
|
composer.phar
|
||||||
|
.phpunit.result.cache
|
||||||
|
/vendor/
|
26
.travis.yml
26
.travis.yml
|
@ -1,26 +0,0 @@
|
||||||
language: php
|
|
||||||
|
|
||||||
php:
|
|
||||||
- 5.3
|
|
||||||
- 5.4
|
|
||||||
- 5.5
|
|
||||||
- 5.6
|
|
||||||
- hhvm
|
|
||||||
- hhvm-nightly
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
allow_failures:
|
|
||||||
- php: hhvm-nightly
|
|
||||||
|
|
||||||
install:
|
|
||||||
- composer install
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- mkdir -p build/logs
|
|
||||||
- cd tests
|
|
||||||
|
|
||||||
script:
|
|
||||||
- phpunit --colors --coverage-clover /home/travis/build/joshtronic/php-projecthoneypot/build/logs/clover.xml .
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- php ../vendor/bin/coveralls --config ../.coveralls.yml -v
|
|
|
@ -11,13 +11,16 @@
|
||||||
"email": "hello@joshtronic.com",
|
"email": "hello@joshtronic.com",
|
||||||
"homepage": "http://joshtronic.com"
|
"homepage": "http://joshtronic.com"
|
||||||
}],
|
}],
|
||||||
"require-dev": {
|
"require": {
|
||||||
"php": ">=5.3.0"
|
"php": ">=5.3.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"satooshi/php-coveralls": "dev-master"
|
"phpunit/phpunit": "^4.8.36 || ^9.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {"joshtronic\\": "src/"}
|
"psr-4": {"joshtronic\\": "src/"}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {"joshtronic\\Tests\\": "tests/"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
24
phpunit.xml
Normal file
24
phpunit.xml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phpunit
|
||||||
|
colors="true"
|
||||||
|
bootstrap="./vendor/autoload.php"
|
||||||
|
convertErrorsToExceptions="true"
|
||||||
|
convertNoticesToExceptions="true"
|
||||||
|
convertWarningsToExceptions="true"
|
||||||
|
failOnRisky="true"
|
||||||
|
stopOnError="true"
|
||||||
|
stopOnFailure="true"
|
||||||
|
stopOnIncomplete="true"
|
||||||
|
verbose="true"
|
||||||
|
>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Project Honeypot">
|
||||||
|
<directory>tests</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<filter>
|
||||||
|
<whitelist addUncoveredFilesFromWhitelist="true">
|
||||||
|
<directory>./src</directory>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
|
</phpunit>
|
|
@ -1,21 +1,22 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace joshtronic\Tests;
|
||||||
|
use joshtronic\ProjectHoneyPot;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
require_once '../src/ProjectHoneyPot.php';
|
class ProjectHoneyPotTest extends TestCase
|
||||||
|
|
||||||
class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @expectedException Exception
|
|
||||||
* @expectedExceptionMessage You must specify a valid API key.
|
|
||||||
*/
|
|
||||||
public function testInvalidKey()
|
public function testInvalidKey()
|
||||||
{
|
{
|
||||||
new joshtronic\ProjectHoneyPot('foo');
|
try {
|
||||||
|
new ProjectHoneyPot('foo');
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->assertSame('You must specify a valid API key.', $e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testInvalidIP()
|
public function testInvalidIP()
|
||||||
{
|
{
|
||||||
$object = new joshtronic\ProjectHoneyPot('foobarfoobar');
|
$object = new ProjectHoneyPot('foobarfoobar');
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array('error' => 'Invalid IP address.'),
|
array('error' => 'Invalid IP address.'),
|
||||||
|
@ -25,11 +26,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testMissingResults()
|
public function testMissingResults()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->getMockBuilder('joshtronic\\ProjectHoneyPot')
|
||||||
'joshtronic\ProjectHoneyPot',
|
->setConstructorArgs(array('foobarfoobar'))
|
||||||
array('dns_get_record'),
|
->setMethods(array('dns_get_record'))
|
||||||
array('foobarfoobar')
|
->getMock();
|
||||||
);
|
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock->expects($this->once())
|
||||||
->method('dns_get_record')
|
->method('dns_get_record')
|
||||||
|
@ -40,11 +40,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory0()
|
public function testCategory0()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->getMockBuilder('joshtronic\\ProjectHoneyPot')
|
||||||
'joshtronic\ProjectHoneyPot',
|
->setConstructorArgs(array('foobarfoobar'))
|
||||||
array('dns_get_record'),
|
->setMethods(array('dns_get_record'))
|
||||||
array('foobarfoobar')
|
->getMock();
|
||||||
);
|
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock->expects($this->once())
|
||||||
->method('dns_get_record')
|
->method('dns_get_record')
|
||||||
|
@ -57,11 +56,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory1()
|
public function testCategory1()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->getMockBuilder('joshtronic\\ProjectHoneyPot')
|
||||||
'joshtronic\ProjectHoneyPot',
|
->setConstructorArgs(array('foobarfoobar'))
|
||||||
array('dns_get_record'),
|
->setMethods(array('dns_get_record'))
|
||||||
array('foobarfoobar')
|
->getMock();
|
||||||
);
|
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock->expects($this->once())
|
||||||
->method('dns_get_record')
|
->method('dns_get_record')
|
||||||
|
@ -74,11 +72,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory2()
|
public function testCategory2()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->getMockBuilder('joshtronic\\ProjectHoneyPot')
|
||||||
'joshtronic\ProjectHoneyPot',
|
->setConstructorArgs(array('foobarfoobar'))
|
||||||
array('dns_get_record'),
|
->setMethods(array('dns_get_record'))
|
||||||
array('foobarfoobar')
|
->getMock();
|
||||||
);
|
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock->expects($this->once())
|
||||||
->method('dns_get_record')
|
->method('dns_get_record')
|
||||||
|
@ -91,11 +88,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory3()
|
public function testCategory3()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->getMockBuilder('joshtronic\\ProjectHoneyPot')
|
||||||
'joshtronic\ProjectHoneyPot',
|
->setConstructorArgs(array('foobarfoobar'))
|
||||||
array('dns_get_record'),
|
->setMethods(array('dns_get_record'))
|
||||||
array('foobarfoobar')
|
->getMock();
|
||||||
);
|
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock->expects($this->once())
|
||||||
->method('dns_get_record')
|
->method('dns_get_record')
|
||||||
|
@ -111,11 +107,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory4()
|
public function testCategory4()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->getMockBuilder('joshtronic\\ProjectHoneyPot')
|
||||||
'joshtronic\ProjectHoneyPot',
|
->setConstructorArgs(array('foobarfoobar'))
|
||||||
array('dns_get_record'),
|
->setMethods(array('dns_get_record'))
|
||||||
array('foobarfoobar')
|
->getMock();
|
||||||
);
|
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock->expects($this->once())
|
||||||
->method('dns_get_record')
|
->method('dns_get_record')
|
||||||
|
@ -131,11 +126,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory5()
|
public function testCategory5()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->getMockBuilder('joshtronic\\ProjectHoneyPot')
|
||||||
'joshtronic\ProjectHoneyPot',
|
->setConstructorArgs(array('foobarfoobar'))
|
||||||
array('dns_get_record'),
|
->setMethods(array('dns_get_record'))
|
||||||
array('foobarfoobar')
|
->getMock();
|
||||||
);
|
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock->expects($this->once())
|
||||||
->method('dns_get_record')
|
->method('dns_get_record')
|
||||||
|
@ -151,11 +145,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory6()
|
public function testCategory6()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->getMockBuilder('joshtronic\\ProjectHoneyPot')
|
||||||
'joshtronic\ProjectHoneyPot',
|
->setConstructorArgs(array('foobarfoobar'))
|
||||||
array('dns_get_record'),
|
->setMethods(array('dns_get_record'))
|
||||||
array('foobarfoobar')
|
->getMock();
|
||||||
);
|
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock->expects($this->once())
|
||||||
->method('dns_get_record')
|
->method('dns_get_record')
|
||||||
|
@ -171,11 +164,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategory7()
|
public function testCategory7()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->getMockBuilder('joshtronic\\ProjectHoneyPot')
|
||||||
'joshtronic\ProjectHoneyPot',
|
->setConstructorArgs(array('foobarfoobar'))
|
||||||
array('dns_get_record'),
|
->setMethods(array('dns_get_record'))
|
||||||
array('foobarfoobar')
|
->getMock();
|
||||||
);
|
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock->expects($this->once())
|
||||||
->method('dns_get_record')
|
->method('dns_get_record')
|
||||||
|
@ -191,11 +183,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testCategoryDefault()
|
public function testCategoryDefault()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->getMockBuilder('joshtronic\\ProjectHoneyPot')
|
||||||
'joshtronic\ProjectHoneyPot',
|
->setConstructorArgs(array('foobarfoobar'))
|
||||||
array('dns_get_record'),
|
->setMethods(array('dns_get_record'))
|
||||||
array('foobarfoobar')
|
->getMock();
|
||||||
);
|
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock->expects($this->once())
|
||||||
->method('dns_get_record')
|
->method('dns_get_record')
|
||||||
|
@ -211,11 +202,10 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testWithout127()
|
public function testWithout127()
|
||||||
{
|
{
|
||||||
$mock = $this->getMock(
|
$mock = $this->getMockBuilder('joshtronic\\ProjectHoneyPot')
|
||||||
'joshtronic\ProjectHoneyPot',
|
->setConstructorArgs(array('foobarfoobar'))
|
||||||
array('dns_get_record'),
|
->setMethods(array('dns_get_record'))
|
||||||
array('foobarfoobar')
|
->getMock();
|
||||||
);
|
|
||||||
|
|
||||||
$mock->expects($this->once())
|
$mock->expects($this->once())
|
||||||
->method('dns_get_record')
|
->method('dns_get_record')
|
||||||
|
@ -227,9 +217,11 @@ class ProjectHoneyPotTest extends PHPUnit_Framework_TestCase
|
||||||
// Doesn't serve much purpose aside from helping achieve 100% coverage
|
// Doesn't serve much purpose aside from helping achieve 100% coverage
|
||||||
public function testDnsGetRecord()
|
public function testDnsGetRecord()
|
||||||
{
|
{
|
||||||
$object = new joshtronic\ProjectHoneyPot('foobarfoobar');
|
$object = new ProjectHoneyPot('foobarfoobar');
|
||||||
|
|
||||||
$object->dns_get_record('1.2.3.4');
|
$result = $object->dns_get_record('1.2.3.4');
|
||||||
|
|
||||||
|
$this->assertEquals(array(), $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue