-
Notifications
You must be signed in to change notification settings - Fork 288
Closed
Labels
bugSomething isn't workingSomething isn't workingpendingThis issue is pending reviewThis issue is pending review
Description
- Laravel Version: 7.18.0
- PHP Version: 7.3.19
- Blueprint Version: dev-master
- Platform: Mac
Issue:
The API Resource Controller update()
does not actually update.
See the output of the generated controller:
/**
* @param \App\Http\Requests\CertificateUpdateRequest $request
* @param \App\Certificate $certificate
* @return \App\Http\Resources\Certificate
*/
public function update(CertificateUpdateRequest $request, Certificate $certificate)
{
$certificate->update([]); // <---- ???
return new CertificateResource($certificate);
}
Which is confirmed by the generated test suite:
❯ php artisan test
PASS Tests\Unit\ExampleTest
✓ basic test
PASS Tests\Feature\ExampleTest
✓ basic test
FAIL Tests\Feature\Http\Controllers\CertificateControllerTest
✓ index behaves as expected
✓ store uses form request validation
✓ store saves
✓ show behaves as expected
✓ update uses form request validation
✕ update behaves as expected
Tests: 1 failed, 7 passed, 8 pending
Failed asserting that two strings are equal.
at tests/Feature/Http/Controllers/CertificateControllerTest.php:127
123|
124| $response->assertOk();
125| $response->assertJsonStructure([]);
126|
> 127| $this->assertEquals($name, $certificate->name);
128| $this->assertEquals($certificate_type->id, $certificate->certificate_type_id);
129| $this->assertEquals($reference, $certificate->reference);
130| $this->assertEquals($document, $certificate->document);
131| $this->assertEquals($expiry_date, $certificate->expiry_date);
--- Expected
+++ Actual
@@ @@
-'Mrs. Hattie Rau MD'
+'Landen Lemke'
draft.yaml:
models:
Certificate:
name: string
certificate_type_id: id
reference: string
document: string
expiry_date: date
remarks: nullable text
CertificateType:
name: string
relationships:
hasMany: Certificate
controllers:
Certificate:
resource: api
CertificateType:
resource: api
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpendingThis issue is pending reviewThis issue is pending review