Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Console/Data/Stats/CollectorTest.php
<?php | <?php | ||||
namespace Tests\Feature\Console\Data\Stats; | namespace Tests\Feature\Console\Data\Stats; | ||||
use App\Http\Controllers\API\V4\Admin\StatsController; | use App\Http\Controllers\API\V4\Admin\StatsController; | ||||
use App\Providers\PaymentProvider; | use App\Payment; | ||||
use Illuminate\Support\Facades\DB; | use Illuminate\Support\Facades\DB; | ||||
use Tests\TestCase; | use Tests\TestCase; | ||||
class CollectorTest extends TestCase | class CollectorTest extends TestCase | ||||
{ | { | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
Show All 31 Lines | public function testHandle(): void | ||||
$this->assertSame(0, $stats->count()); | $this->assertSame(0, $stats->count()); | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$wallet = $john->wallet(); | $wallet = $john->wallet(); | ||||
\App\Payment::create([ | \App\Payment::create([ | ||||
'id' => 'test1', | 'id' => 'test1', | ||||
'description' => '', | 'description' => '', | ||||
'status' => PaymentProvider::STATUS_PAID, | 'status' => Payment::STATUS_PAID, | ||||
'amount' => 1000, | 'amount' => 1000, | ||||
'credit_amount' => 1000, | 'credit_amount' => 1000, | ||||
'type' => PaymentProvider::TYPE_ONEOFF, | 'type' => Payment::TYPE_ONEOFF, | ||||
'wallet_id' => $wallet->id, | 'wallet_id' => $wallet->id, | ||||
'provider' => 'mollie', | 'provider' => 'mollie', | ||||
'currency' => $wallet->currency, | 'currency' => $wallet->currency, | ||||
'currency_amount' => 1000, | 'currency_amount' => 1000, | ||||
]); | ]); | ||||
$code = \Artisan::call("data:stats:collector"); | $code = \Artisan::call("data:stats:collector"); | ||||
$output = trim(\Artisan::output()); | $output = trim(\Artisan::output()); | ||||
Show All 13 Lines |