Skip to content

Commit 13109cf

Browse files
authored
Merge pull request #22 from Steveb-p/phpunit
Update PHPUnit to version 8/9
2 parents a058502 + 30edb68 commit 13109cf

File tree

5 files changed

+124
-79
lines changed

5 files changed

+124
-79
lines changed

.github/workflows/php.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: PHP
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
tests:
14+
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
php:
19+
- '7.2'
20+
- '7.4'
21+
composer_preference:
22+
- 'lowest'
23+
- 'highest'
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
28+
- name: Setup PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: ${{ matrix.php }}
32+
coverage: none
33+
34+
- uses: ramsey/composer-install@v2
35+
with:
36+
dependency-versions: ${{ matrix.composer_preference }}
37+
38+
- name: Run test suite
39+
run: composer run-script test

composer.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,19 @@
2222
"rct567/dom-query": "^0.8.0"
2323
},
2424
"require-dev": {
25-
"phpunit/phpunit": "^6.1"
25+
"phpunit/phpunit": "^8|^9"
2626
},
2727
"autoload": {
28-
"psr-0": {
29-
"Lodestone\\": "src/"
28+
"psr-4": {
29+
"Lodestone\\": "src/Lodestone"
3030
}
31+
},
32+
"autoload-dev": {
33+
"psr-4": {
34+
"Lodestone\\Tests\\": "tests/"
35+
}
36+
},
37+
"scripts": {
38+
"test": "phpunit"
3139
}
3240
}

phpunit.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
cacheResultFile=".phpunit.cache/test-results"
6+
executionOrder="depends,defects"
7+
beStrictAboutCoversAnnotation="true"
8+
beStrictAboutOutputDuringTests="true"
9+
beStrictAboutTodoAnnotatedTests="true"
10+
convertDeprecationsToExceptions="true"
11+
failOnRisky="true"
12+
failOnWarning="true"
13+
verbose="true">
14+
<testsuites>
15+
<testsuite name="default">
16+
<directory>tests</directory>
17+
</testsuite>
18+
</testsuites>
19+
</phpunit>

tests

Lines changed: 0 additions & 76 deletions
This file was deleted.

tests/BasicTest.php

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
namespace Lodestone\Tests;
4+
5+
use PHPUnit\Framework\TestCase;
6+
7+
final class BasicTest extends TestCase
8+
{
9+
public function test(): void
10+
{
11+
// create api instance
12+
$api = new \Lodestone\Api();
13+
14+
// Easy adjusting of tests
15+
$user = '9575452';
16+
$expectedUserName = 'Arcane Disgea';
17+
$fc = '9232379236109629819';
18+
$expectedfc = 'Hell On Aura';
19+
$ls = '18014398509568031';
20+
$pvp = '59665d98bf81ff58db63305b538cd69a6c64d578';
21+
$bio = "This is a test of the emergency alert system.\nAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\n\nECU125614VC";
22+
23+
$character = $api->character()->get($user);
24+
self::assertSame($expectedUserName, $character->Name);
25+
self::assertSame($bio, $character->Bio);
26+
27+
self::assertNotEmpty($api->character()->friends($user));
28+
self::assertNotEmpty($api->character()->following($user));
29+
// self::assertTrue($api->character()->achievements($user)->PointsTotal > 0); AHHHHHHHHHHHHHHHH
30+
// self::assertNotEmpty($api->getCharacterAchievementsFull($user)->Achievements); This may not be relevant anymore
31+
self::assertSame($expectedfc, $api->FreeCompany()->get($fc)->Name);
32+
// self::assertSame($api->getFreeCompanyFull('9233927348481473031')->Profile->ID, '9233927348481473031'); This may not be relevant anymore
33+
self::assertNotEmpty($api->FreeCompany()->members($fc)->Results);
34+
self::assertNotEmpty($api->Linkshell()->get($ls)->Results);
35+
self::assertNotEmpty($api->PvPTeam()->get($pvp)->Results);
36+
self::assertNotEmpty($api->Character()->search($expectedUserName)->Results);
37+
self::assertNotEmpty($api->FreeCompany()->search('a')->Results);
38+
self::assertNotEmpty($api->Linkshell()->search('a')->Results);
39+
self::assertNotEmpty($api->PvPTeam()->search('a')->Results);
40+
self::assertNotEmpty($api->lodestone()->banners());
41+
//self::assertNotEmpty($api->lodestone()->News());
42+
//self::assertNotEmpty($api->lodestone()->Topics());
43+
//self::assertNotEmpty($api->lodestone()->Notices());
44+
//self::assertNotEmpty($api->lodestone()->Maintenance());
45+
//self::assertNotEmpty($api->lodestone()->Updates());
46+
//self::assertNotEmpty($api->lodestone()->Status());
47+
self::assertNotEmpty($api->lodestone()->WorldStatus());
48+
self::assertNotEmpty($api->devposts()->blog());
49+
# self::assertNotEmpty($api->getDevPosts()); - this takes agessssss
50+
self::assertNotEmpty($api->leaderboards()->feast());
51+
self::assertNotEmpty($api->leaderboards()->ddPalaceOfTheDead());
52+
self::assertNotEmpty($api->leaderboards()->ddHeavenOnHigh());
53+
54+
}
55+
}

0 commit comments

Comments
 (0)