Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide a few jobs test coverage #300

Draft
wants to merge 42 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
c3d6edc
test(jobs): cover character info
warlof Mar 18, 2021
98b7089
test(jobs): cover character affiliation
warlof Mar 18, 2021
8db1c84
test(jobs): rename class to match with setup
warlof Mar 18, 2021
60bf762
test(jobs): add character agent research coverage
warlof Mar 18, 2021
e4911b8
chore: update licence header
warlof Mar 18, 2021
02afc82
ci: add travis setup
warlof Mar 18, 2021
40a4b5b
ci: enable code coverage
warlof Mar 18, 2021
2ec3307
test(jobs): add character blueprints coverage
warlof Mar 18, 2021
fe4dcec
test(jobs): add more character coverage
warlof Mar 20, 2021
3123bd0
refactor: remove unneeded constructor
warlof Mar 20, 2021
b7cf9fb
test(jobs): add standing coverage
warlof Mar 27, 2021
e47d668
test(jobs): add character titles coverage
warlof Mar 27, 2021
f49da21
refactor: switch character artifact directory to singular
warlof Mar 27, 2021
9387e79
test(jobs): add corporation info coverage
warlof Mar 27, 2021
4ee6ccb
test(jobs): add corporation alliance history coverage
warlof Mar 27, 2021
4b3e1ec
test(jobs): add corporation blueprints coverage
warlof Mar 27, 2021
4911d9d
test(jobs): add corporation divisions coverage
warlof Mar 27, 2021
38e48af
test(jobs): add corporation facilities coverage
warlof Mar 27, 2021
e8187db
test(jobs): add corporation medals coverage
warlof Mar 27, 2021
2aa505f
test(jobs): add corporation members coverage
warlof Mar 27, 2021
1aca59d
test(jobs): add corporation limit coverage
warlof Mar 27, 2021
87c0a3f
test(jobs): add corporation member tracking coverage
warlof Mar 27, 2021
c23ea8b
test(jobs): add fittings coverage
warlof Apr 2, 2021
4c5e873
feat(jobs): remove old insurances during update
warlof Apr 2, 2021
d51158a
test(jobs): add fittings insurances coverage
warlof Apr 2, 2021
d3d9efb
test(jobs): add character attributes coverage
warlof Apr 2, 2021
7ac21e7
test(jobs): add character skill queue coverage
warlof Apr 2, 2021
efeab85
test(jobs): add character skills coverage
warlof Apr 2, 2021
f639fea
style: add missing semicolon on casts attribute
warlof Apr 2, 2021
1c8ecda
revert: restore posix dependency
warlof Apr 2, 2021
4c1b997
test: add clones coverage
warlof Apr 4, 2021
af233ad
test: add alliances info coverage
warlof Apr 4, 2021
943a56d
refactor(relationship): use pivot table to link alliance together wit…
warlof Apr 4, 2021
97d1775
test: add alliance corporations coverage
warlof Apr 4, 2021
d917e6d
test: add alliance contacts coverage
warlof Apr 4, 2021
e2e087b
test: add corporation contacts coverage
warlof Apr 4, 2021
e3e1380
test: add character contacts coverage
warlof Apr 4, 2021
a12853e
test: add character contact labels coverage
warlof Apr 4, 2021
3b88680
test: add corporation contact labels coverage
warlof Apr 4, 2021
33eece9
test: add alliance contact labels coverage
warlof Apr 4, 2021
443680d
test: add character relationship coverage
warlof Apr 4, 2021
44151f8
ci: test codecov
warlof Apr 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
language: php
env:
global:
- XDEBUG_MODE=coverage
php:
- 7.3
before_script:
- pecl install -o -f redis <<<""
- composer update
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
script:
- vendor/bin/phpunit -c phpunit.xml
after_script:
- ./cc-test-reporter after-build
after_success:
- bash <(curl -s https://codecov.io/bash)
10 changes: 10 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
"Seat\\Eveapi\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Seat\\Eveapi\\Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
Expand All @@ -27,6 +32,11 @@
"ext-posix": "*",
"ext-redis": "*"
},
"require-dev": {
"josiasmontag/laravel-redis-mock": "^1.0",
"orchestra/testbench": "^4.0",
"orchestra/database": "^4.0"
},
"extra": {
"laravel": {
"providers": [
Expand Down
31 changes: 31 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
>
<coverage includeUncoveredFiles="false">
<include>
<directory suffix=".php">src/</directory>
</include>
<report>
<clover outputFile="build/logs/clover.xml" />
</report>
</coverage>

<testsuites>
<testsuite name="Esi Jobs Test Suite">
<directory suffix="Test.php">./tests/Jobs/Esi/</directory>
</testsuite>
<testsuite name="Relationship Test Suite">
<directory suffix="Test.php">./tests/Relationship/</directory>
</testsuite>
</testsuites>

</phpunit>
11 changes: 0 additions & 11 deletions src/Commands/Esi/Meta/Ping.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,6 @@ class Ping extends Command
*/
protected $description = 'Perform an ESI status check';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{

parent::__construct();
}

/**
* Execute the console command.
*
Expand Down
64 changes: 63 additions & 1 deletion src/Commands/Esi/Update/PublicInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
use Seat\Eveapi\Jobs\Universe\Names;
use Seat\Eveapi\Models\Character\CharacterInfo;
use Seat\Eveapi\Models\Corporation\CorporationInfo;
use Seat\Eveapi\Models\Wallet\CharacterWalletJournal;
use Seat\Eveapi\Models\Wallet\CharacterWalletTransaction;
use Seat\Eveapi\Models\Wallet\CorporationWalletJournal;
use Seat\Eveapi\Models\Wallet\CorporationWalletTransaction;

/**
* Class PublicInfo.
Expand All @@ -54,7 +58,11 @@ class PublicInfo extends Command
*/
public function handle()
{
Names::dispatch();
$entities_list = $this->buildUniqueEntitiesIdList();

$entities_list->chunk(Names::ITEMS_LIMIT)->each(function ($chunk) {
Names::dispatch($chunk);
});

CharacterInfo::doesntHave('refresh_token')->each(function ($character) {
(new Character($character->character_id))->fire();
Expand All @@ -64,4 +72,58 @@ public function handle()
(new Corporation($corporation->corporation_id))->fire();
});
}

/**
* @return array
*/
private function buildUniqueEntitiesIdList()
{
$entities_id = collect();

// collect entries from character wallet
$entities_id->push(CharacterWalletJournal::select('first_party_id')
->whereNotNull('first_party_id')
->distinct()
->get()
->pluck('first_party_id')
->toArray());

$entities_id->push(CharacterWalletJournal::select('second_party_id')
->whereNotNull('second_party_id')
->distinct()
->get()
->pluck('second_party_id')
->toArray());

$entities_id->push(CharacterWalletTransaction::select('client_id')
->whereNotNull('client_id')
->distinct()
->get()
->pluck('client_id')
->toArray());

// collect entities from corporation wallet
$entities_id->push(CorporationWalletJournal::select('first_party_id')
->whereNotNull('first_party_id')
->distinct()
->get()
->pluck('first_party_id')
->toArray());

$entities_id->push(CorporationWalletJournal::select('second_party_id')
->whereNotNull('second_party_id')
->distinct()
->get()
->pluck('second_party_id')
->toArray());

$entities_id->push(CorporationWalletTransaction::select('client_id')
->whereNotNull('client_id')
->distinct()
->get()
->pluck('client_id')
->toArray());

return $entities_id->unique()->toArray();
}
}
10 changes: 0 additions & 10 deletions src/Commands/Eve/Update/Sde.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,6 @@ class Sde extends Command
*/
protected $storage_path;

/**
* Create a new command instance.
*/
public function __construct()
{

parent::__construct();

}

/**
* Query the eveseat/resources repository for SDE
* related information.
Expand Down
11 changes: 0 additions & 11 deletions src/Commands/Seat/Cache/Clear.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,6 @@ class Clear extends Command
*/
protected $description = 'Clear caches used by SeAT.';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{

parent::__construct();
}

/**
* Execute the console command.
*/
Expand Down
11 changes: 0 additions & 11 deletions src/Commands/Seat/Tokens/Upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,6 @@ class Upgrade extends Command
*/
protected $description = 'Upgrade all tokens to latest sso version';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{

parent::__construct();
}

/**
* Execute the console command.
*/
Expand Down
22 changes: 8 additions & 14 deletions src/Jobs/Alliances/Members.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
namespace Seat\Eveapi\Jobs\Alliances;

use Seat\Eveapi\Jobs\EsiBase;
use Seat\Eveapi\Models\Alliances\AllianceMember;
use Seat\Eveapi\Jobs\Universe\Names;
use Seat\Eveapi\Models\Alliances\Alliance;

/**
* Class Members.
Expand Down Expand Up @@ -78,22 +79,15 @@ public function handle()
'alliance_id' => $this->alliance_id,
]);

if ($corporations->isCachedLoad() && AllianceMember::where('alliance_id', $this->alliance_id)->count() > 0)
return;

$corporation_ids = collect($corporations);
$alliance = Alliance::find($this->alliance_id);

$corporation_ids->each(function ($corporation_id) {
if ($corporations->isCachedLoad() && $alliance->members->count() > 0)
return;

AllianceMember::firstOrCreate([
'alliance_id' => $this->alliance_id,
'corporation_id' => $corporation_id,
]);
});
$name_job = new Names((array) $corporations);
$name_job->handle();

AllianceMember::where('alliance_id', $this->alliance_id)
->whereNotIn('corporation_id', $corporation_ids->flatten()->all())
->delete();
$alliance->members()->sync($corporations);
}

/**
Expand Down
94 changes: 0 additions & 94 deletions src/Jobs/Character/Stats.php

This file was deleted.

Loading