Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edalzell committed May 29, 2024
1 parent 1638b22 commit bf82d1e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/Assets/AssetContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,18 @@ public function it_gets_and_sets_whether_downloading_is_allowed()
$this->assertFalse($container->allowDownloading());
}

/** @test */
public function it_gets_and_sets_the_validation_rules()
{
$container = new AssetContainer;
$this->assertNull($container->validation());

$return = $container->validation(['max:5120']);

$this->assertEquals($container, $return);
$this->assertEquals(['max:5120'], $container->validation());
}

/** @test */
public function it_gets_and_sets_glide_source_preset_for_upload_processing()
{
Expand Down
12 changes: 12 additions & 0 deletions tests/Feature/Assets/StoreAssetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ public function it_doesnt_upload_without_a_folder()
])->assertStatus(422);
}

/** @test */
public function it_doesnt_upload_when_validation_fails()
{

$this->container->validation(['extensions:png'])->save();

$this
->actingAs($this->userWithPermission())
->submit()
->assertStatus(422);
}

private function submit($overrides = [])
{
return $this->postJson(cp_route('assets.store'), $this->validPayload($overrides));
Expand Down

0 comments on commit bf82d1e

Please sign in to comment.