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

Resolve #3269 #3362

Merged
merged 1 commit into from
Dec 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion app/Bus/Commands/Component/CreateComponentCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ final class CreateComponentCommand
*/
public $rules = [
'name' => 'required|string',
'description' => 'required|string',
'description' => 'nullable|string',
'status' => 'required|int|min:0|max:4',
'link' => 'nullable|url',
'order' => 'nullable|int',
Expand Down
15 changes: 15 additions & 0 deletions tests/Api/ComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,21 @@ public function test_can_create_component()
$response->assertJsonFragment(['name' => 'Foo']);
}

public function test_can_create_minimal_component()
{
$this->beUser();

$this->expectsEvents(ComponentWasCreatedEvent::class);

$response = $this->json('POST', '/api/v1/components', [
'name' => 'Foo',
'status' => 1,
]);

$response->assertStatus(200);
$response->assertJsonFragment(['name' => 'Foo']);
}

public function test_can_create_component_without_enabled_field()
{
$this->beUser();
Expand Down