refactor job names

This commit is contained in:
David Bomba 2019-05-16 16:00:27 +10:00
parent 543795bc74
commit 289556e673
4 changed files with 13 additions and 10 deletions

View File

@ -25,7 +25,7 @@ use App\Http\Requests\Invoice\ShowInvoiceRequest;
use App\Http\Requests\Invoice\StoreInvoiceRequest; use App\Http\Requests\Invoice\StoreInvoiceRequest;
use App\Http\Requests\Invoice\UpdateInvoiceRequest; use App\Http\Requests\Invoice\UpdateInvoiceRequest;
use App\Jobs\Entity\ActionEntity; use App\Jobs\Entity\ActionEntity;
use App\Jobs\Invoice\MarkPaid; use App\Jobs\Invoice\MarkInvoicePaid;
use App\Jobs\Invoice\StoreInvoice; use App\Jobs\Invoice\StoreInvoice;
use App\Models\Invoice; use App\Models\Invoice;
use App\Repositories\BaseRepository; use App\Repositories\BaseRepository;
@ -237,9 +237,12 @@ class InvoiceController extends BaseController
if($invoice->balance == 0 || $invoice->status_id == Invoice::STATUS_PAID) if($invoice->balance == 0 || $invoice->status_id == Invoice::STATUS_PAID)
return $this->errorResponse(['message' => 'Invoice has no balance owing'], 400); return $this->errorResponse(['message' => 'Invoice has no balance owing'], 400);
$invoice = MarkPaid::dispatchNow($invoice); $invoice = MarkInvoicePaid::dispatchNow($invoice);
return $this->itemResponse($invoice); return $this->itemResponse($invoice);
break; break;
case 'download':
# code...
break;
case 'archive': case 'archive':
# code... # code...
break; break;

View File

@ -25,7 +25,7 @@ use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
class MarkPaid implements ShouldQueue class MarkInvoicePaid implements ShouldQueue
{ {
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

View File

@ -2,7 +2,7 @@
namespace Tests\Integration; namespace Tests\Integration;
use App\Jobs\Invoice\MarkPaid; use App\Jobs\Invoice\MarkInvoicePaid;
use App\Models\Account; use App\Models\Account;
use App\Models\Company; use App\Models\Company;
use App\Models\Invoice; use App\Models\Invoice;
@ -15,9 +15,9 @@ use Tests\TestCase;
/** /**
* @test * @test
* @covers App\Jobs\Invoice\MarkPaid * @covers App\Jobs\Invoice\MarkInvoicePaid
*/ */
class MarkPaidInvoiceTest extends TestCase class MarkInvoicePaidTest extends TestCase
{ {
use MockAccountData; use MockAccountData;
use DatabaseTransactions; use DatabaseTransactions;
@ -34,9 +34,9 @@ class MarkPaidInvoiceTest extends TestCase
$this->assertNotNull($this->client); $this->assertNotNull($this->client);
} }
public function testMarkPaidInvoice() public function testMarkInvoicePaidInvoice()
{ {
MarkPaid::dispatchNow($this->invoice); MarkInvoicePaid::dispatchNow($this->invoice);
$invoice = Invoice::find($this->invoice->id); $invoice = Invoice::find($this->invoice->id);

View File

@ -5,7 +5,7 @@ namespace Tests\Integration;
use App\Events\Invoice\InvoiceWasCreated; use App\Events\Invoice\InvoiceWasCreated;
use App\Events\Invoice\InvoiceWasUpdated; use App\Events\Invoice\InvoiceWasUpdated;
use App\Events\Payment\PaymentWasCreated; use App\Events\Payment\PaymentWasCreated;
use App\Jobs\Invoice\MarkPaid; use App\Jobs\Invoice\MarkInvoicePaid;
use App\Models\Account; use App\Models\Account;
use App\Models\Activity; use App\Models\Activity;
use App\Models\Company; use App\Models\Company;
@ -37,7 +37,7 @@ class UpdateCompanyLedgerTest extends TestCase
public function testPaymentIsPresentInLedger() public function testPaymentIsPresentInLedger()
{ {
$invoice = MarkPaid::dispatchNow($this->invoice); $invoice = MarkInvoicePaid::dispatchNow($this->invoice);
$ledger = CompanyLedger::whereClientId($invoice->client_id) $ledger = CompanyLedger::whereClientId($invoice->client_id)