Skip to content

FOUR-20912: Enhance Test Coverage for Screens Functionality Before Adding Cache #7764

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

Merged
merged 2 commits into from
Nov 26, 2024

Conversation

rodriquelca
Copy link
Contributor

…dding Cache

Issue & Reproduction Steps

As a developer I want to improve test coverage for tests/Feature/Screens/ScreenCompiledManagerTest.php test

Solution

  • refactor get key test
  • add exception tests
  • add empty compile content test
  • add clear assets when the directory does not exist
image image

How to Test

run the next command s
// run the test php artisan test --filter=ScreenCompiledManagerTest // check coverage vendor/bin/phpunit --coverage-html coverage-report tests/Feature/Screens/ScreenCompiledManagerTest.php

Related Tickets & Packages

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

@rodriquelca rodriquelca requested a review from caleeli November 25, 2024 21:01
Copy link
Contributor

@caleeli caleeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a negative test, when the storage fails. Something like:

/** @test */
public function it_handles_storage_limit_scenarios()
{
    // Mock storage reaching its limit
    Storage::shouldReceive('disk->put')
        ->andThrow(new \Illuminate\Contracts\Filesystem\FileNotFoundException());
    
    $key = $this->manager->createKey('1', '1', 'en', '1', '1');
    
    $this->expectException(\Exception::class);
    $this->manager->storeCompiledContent($key, ['test' => 'content']);
}

@rodriquelca rodriquelca reopened this Nov 26, 2024
@caleeli caleeli self-requested a review November 26, 2024 16:35
@caleeli caleeli merged commit d2ca132 into epic/FOUR-20326 Nov 26, 2024
14 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants