Skip to content

Commit

Permalink
Added tests & testing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Schläpfer committed Oct 10, 2023
1 parent 2cb7b98 commit e61ac3d
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 1 deletion.
61 changes: 60 additions & 1 deletion .github/workflows/php-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,63 @@ jobs:
with:
php_version: latest
configuration: phpstan.neon
memory_limit: 512M
memory_limit: 512M

phpunit:
runs-on: ubuntu-latest
needs: [ composer, phpstan-release ]
strategy:
matrix:
php: [ 8.0, 8.1, 8.2 ]

name: PHP ${{ matrix.php }} - PHPUnit
steps:

- uses: actions/download-artifact@v3
with:
name: build-archive-php
path: /tmp/builds

- name: Extract build archive
run: tar -xvf /tmp/builds/build.tar ./

- name: Get the Latest FOSSBilling Release Tag
uses: oprypin/find-latest-tag@v1
with:
repository: "FOSSBilling/FOSSBilling"
releases-only: true
id: get_id

- name: Checkout The Release tag
uses: actions/checkout@v4
with:
repository: "FOSSBilling/FOSSBilling"
path: "FOSSBilling"
ref: ${{ steps.get_id.outputs.tag }}

- name: Install Composer Dependencies (<=0.4.x)
if: ${{ hashFiles('FOSSBilling/src/composer.json') }}
uses: php-actions/composer@v6
with:
args: --working-dir=FOSSBilling/src
dev: no

- name: Install Composer Dependencies (>=0.5.0)
if: ${{ hashFiles('FOSSBilling/composer.json') }}
uses: php-actions/composer@v6
with:
args: --working-dir=FOSSBilling/
dev: no

- name: Create Build Archive for Tests
run: |
cp FOSSBilling/src/config-sample.php FOSSBilling/src/config.php
mkdir -p FOSSBilling/src/data/cache
mkdir -p FOSSBilling/src/data/log
echo > FOSSBilling/src/data/log/license.log
echo > FOSSBilling/src/data/log/application.log
echo > FOSSBilling/src/data/log/php_error.log
- name: list files
run: ls -alh ./

28 changes: 28 additions & 0 deletions tests/Serviceproxmox/Api/AdminTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php


namespace Box\Mod\Serviceproxmox;


class AdminTest extends \BBTestCase
{

/**
* @var \Box\Mod\Serviceproxmox\Api\Admin
*/
protected $api = null;

public function setup(): void
{
$this->api = new \Box\Mod\Serviceproxmox\Api\Admin();
}

public function testgetDi()
{
$di = new \Pimple\Container();
$this->api->setDi($di);
$getDi = $this->api->getDi();
$this->assertEquals($di, $getDi);
}

}
26 changes: 26 additions & 0 deletions tests/Serviceproxmox/Api/ClientTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php


namespace Box\Mod\Serviceproxmox\Api;


class ClientTest extends \BBTestCase {
/**
* @var \Box\Mod\Serviceproxmox\Api\Client
*/
protected $api = null;

public function setup(): void
{
$this->api= new \Box\Mod\Serviceproxmox\Api\Client();
}

public function testgetDi()
{
$di = new \Pimple\Container();
$this->api->setDi($di);
$getDi = $this->api->getDi();
$this->assertEquals($di, $getDi);
}
}

29 changes: 29 additions & 0 deletions tests/Serviceproxmox/ServiceTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php


namespace Box\Mod\Serviceproxmox;

class ServiceTest extends \BBTestCase {
/**
* @var \Box\Mod\Serviceproxmox\Service
*/
protected $service = null;

public function setup(): void
{
$this->service= new \Box\Mod\Serviceproxmox\Service();
}


public function testgetDi()
{
$di = new \Pimple\Container();
$this->service->setDi($di);
$getDi = $this->service->getDi();
$this->assertEquals($di, $getDi);
}




}

0 comments on commit e61ac3d

Please sign in to comment.