Skip to content

Commit

Permalink
Merge pull request #22 from Steveb-p/phpunit
Browse files Browse the repository at this point in the history
Update PHPUnit to version 8/9
  • Loading branch information
Supamiu authored Jan 5, 2024
2 parents a058502 + 30edb68 commit 13109cf
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 79 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/php.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: PHP

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
tests:

runs-on: ubuntu-latest
strategy:
matrix:
php:
- '7.2'
- '7.4'
composer_preference:
- 'lowest'
- 'highest'

steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.composer_preference }}

- name: Run test suite
run: composer run-script test
14 changes: 11 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,19 @@
"rct567/dom-query": "^0.8.0"
},
"require-dev": {
"phpunit/phpunit": "^6.1"
"phpunit/phpunit": "^8|^9"
},
"autoload": {
"psr-0": {
"Lodestone\\": "src/"
"psr-4": {
"Lodestone\\": "src/Lodestone"
}
},
"autoload-dev": {
"psr-4": {
"Lodestone\\Tests\\": "tests/"
}
},
"scripts": {
"test": "phpunit"
}
}
19 changes: 19 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
executionOrder="depends,defects"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
verbose="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
76 changes: 0 additions & 76 deletions tests

This file was deleted.

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

namespace Lodestone\Tests;

use PHPUnit\Framework\TestCase;

final class BasicTest extends TestCase
{
public function test(): void
{
// create api instance
$api = new \Lodestone\Api();

// Easy adjusting of tests
$user = '9575452';
$expectedUserName = 'Arcane Disgea';
$fc = '9232379236109629819';
$expectedfc = 'Hell On Aura';
$ls = '18014398509568031';
$pvp = '59665d98bf81ff58db63305b538cd69a6c64d578';
$bio = "This is a test of the emergency alert system.\nAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\n\nECU125614VC";

$character = $api->character()->get($user);
self::assertSame($expectedUserName, $character->Name);
self::assertSame($bio, $character->Bio);

self::assertNotEmpty($api->character()->friends($user));
self::assertNotEmpty($api->character()->following($user));
// self::assertTrue($api->character()->achievements($user)->PointsTotal > 0); AHHHHHHHHHHHHHHHH
// self::assertNotEmpty($api->getCharacterAchievementsFull($user)->Achievements); This may not be relevant anymore
self::assertSame($expectedfc, $api->FreeCompany()->get($fc)->Name);
// self::assertSame($api->getFreeCompanyFull('9233927348481473031')->Profile->ID, '9233927348481473031'); This may not be relevant anymore
self::assertNotEmpty($api->FreeCompany()->members($fc)->Results);
self::assertNotEmpty($api->Linkshell()->get($ls)->Results);
self::assertNotEmpty($api->PvPTeam()->get($pvp)->Results);
self::assertNotEmpty($api->Character()->search($expectedUserName)->Results);
self::assertNotEmpty($api->FreeCompany()->search('a')->Results);
self::assertNotEmpty($api->Linkshell()->search('a')->Results);
self::assertNotEmpty($api->PvPTeam()->search('a')->Results);
self::assertNotEmpty($api->lodestone()->banners());
//self::assertNotEmpty($api->lodestone()->News());
//self::assertNotEmpty($api->lodestone()->Topics());
//self::assertNotEmpty($api->lodestone()->Notices());
//self::assertNotEmpty($api->lodestone()->Maintenance());
//self::assertNotEmpty($api->lodestone()->Updates());
//self::assertNotEmpty($api->lodestone()->Status());
self::assertNotEmpty($api->lodestone()->WorldStatus());
self::assertNotEmpty($api->devposts()->blog());
# self::assertNotEmpty($api->getDevPosts()); - this takes agessssss
self::assertNotEmpty($api->leaderboards()->feast());
self::assertNotEmpty($api->leaderboards()->ddPalaceOfTheDead());
self::assertNotEmpty($api->leaderboards()->ddHeavenOnHigh());

}
}

0 comments on commit 13109cf

Please sign in to comment.