-
Notifications
You must be signed in to change notification settings - Fork 288
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
As mentioned in #171
Given the following contents of draft.yaml
:
models:
Certificate:
name: string
reference: string
document: string
expiry_date: date
remarks: nullable text
controllers:
Certificate:
resource: api
Where we use a resource: api
to generate an REST API Controller.
Running blueprint:build
will yield:
- database/migrations/2020_05_02_092122_create_certificates_table.php
- app/Certificate.php
- database/factories/CertificateFactory.php
- app/Http/Controllers/CertificateController.php
- app/Http/Requests/CertificateStoreRequest.php
- app/Http/Requests/CertificateUpdateRequest.php
- app/Http/Resources/CertificateCollection.php
- app/Http/Resources/Certificate.php
- tests/Feature/Http/Controllers/CertificateControllerTest.php
If we inspect the StoreRequest and UpdateRequest, and particularly the rules()
within, we will find the following bogus rule:
public function rules()
{
return [
'certificate' => 'required',
];
}
The expectation here is that the rules should match/correspond with the model's definition.
The generated tests also fail because of this:
❯ phpunit 28%
PHPUnit 8.5.4 by Sebastian Bergmann and contributors.
..R.FR.R. 9 / 9 (100%)
Time: 326 ms, Memory: 30.00 MB
There was 1 failure:
1) Tests\Feature\Http\Controllers\CertificateControllerTest::store_saves
Failed asserting that actual size 0 matches expected size 1.
/Users/joostjacobs/Code/blueprint/tests/Feature/Http/Controllers/CertificateControllerTest.php:55
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request