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

Improvements to Test Coverage #128

Merged
merged 6 commits into from
Apr 15, 2021

Conversation

Kenny-MWI
Copy link
Contributor

This adds a few small tests to slightly improve test coverage. I wanted to add tests for Events and the methods in the TipoffPackage.php file but I'm not sure about the best way to do those. I'm going to switch my efforts over to the packages in the priority list instead.

Here's the test coverage report for this PR:

Code Coverage Report:      
  2021-04-14 15:52:22      
                           
 Summary:                  
  Classes: 32.14% (9/28)   
  Methods: 52.21% (59/113) 
  Lines:   65.68% (222/338)

Tipoff\Support\Casts\DiscountableValue
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% ( 11/ 11)
Tipoff\Support\Casts\Enum
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% ( 10/ 10)
Tipoff\Support\Casts\Money
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% (  8/  8)
Tipoff\Support\Enums\AppliesTo
  Methods:  ( 0/ 0)   Lines:  (  0/  0)
Tipoff\Support\Enums\BaseEnum
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% (  6/  6)
Tipoff\Support\Enums\LayoutType
  Methods:  ( 0/ 0)   Lines:  (  0/  0)
Tipoff\Support\Events\BaseEvent
  Methods:  ( 0/ 0)   Lines:  (  0/  0)
Tipoff\Support\Events\Checkout\CartItemCreated
  Methods:   0.00% ( 0/ 1)   Lines:   0.00% (  0/  2)
Tipoff\Support\Events\Checkout\CartItemPurchaseVerification
  Methods:   0.00% ( 0/ 1)   Lines:   0.00% (  0/  2)
Tipoff\Support\Events\Checkout\CartItemRemoved
  Methods:   0.00% ( 0/ 1)   Lines:   0.00% (  0/  2)
Tipoff\Support\Events\Checkout\CartItemUpdated
  Methods:   0.00% ( 0/ 1)   Lines:   0.00% (  0/  2)
Tipoff\Support\Events\Checkout\CartUpdated
  Methods:   0.00% ( 0/ 1)   Lines:   0.00% (  0/  1)
Tipoff\Support\Events\Checkout\OrderCreated
  Methods:   0.00% ( 0/ 1)   Lines:   0.00% (  0/  1)
Tipoff\Support\Events\Checkout\OrderItemCreated
  Methods:   0.00% ( 0/ 1)   Lines:   0.00% (  0/  2)
Tipoff\Support\Events\Checkout\SellableEvent
  Methods:   0.00% ( 0/ 2)   Lines:   0.00% (  0/  2)
Tipoff\Support\Http\Controllers\Api\BaseApiController
  Methods: 100.00% ( 9/ 9)   Lines: 100.00% ( 16/ 16)
Tipoff\Support\Http\Controllers\BaseController
  Methods:  ( 0/ 0)   Lines:  (  0/  0)
Tipoff\Support\Http\Requests\BaseApiRequest
  Methods:   0.00% ( 0/ 5)   Lines:   0.00% (  0/ 20)
Tipoff\Support\Models\BaseModel
  Methods:  53.85% ( 7/13)   Lines:  40.91% (  9/ 22)
Tipoff\Support\Models\TestModelStub
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 13/ 13)
Tipoff\Support\Nova\BaseResource
  Methods:   0.00% ( 0/15)   Lines:   0.00% (  0/ 24)
Tipoff\Support\Nova\Fields\Enum
  Methods:   0.00% ( 0/ 2)   Lines:   0.00% (  0/  8)
Tipoff\Support\Nova\Filters\EnumFilter
  Methods:   0.00% ( 0/ 4)   Lines:   0.00% (  0/  7)
Tipoff\Support\Objects\DiscountableValue
  Methods:  90.00% ( 9/10)   Lines:  95.00% ( 19/ 20)
Tipoff\Support\Rules\Enum
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% (  4/  4)
Tipoff\Support\SupportServiceProvider
  Methods: 100.00% ( 4/ 4)   Lines: 100.00% ( 16/ 16)
Tipoff\Support\TipoffPackage
  Methods:  62.50% (10/16)   Lines:  65.00% ( 26/ 40)
Tipoff\Support\TipoffServiceProvider
  Methods:  66.67% ( 2/ 3)   Lines:  96.77% ( 30/ 31)
Tipoff\Support\Traits\HasCreator
  Methods:   0.00% ( 0/ 2)   Lines:   0.00% (  0/  4)
Tipoff\Support\Traits\HasPackageFactory
  Methods:   0.00% ( 0/ 1)   Lines:   0.00% (  0/  4)
Tipoff\Support\Traits\HasUpdater
  Methods:   0.00% ( 0/ 2)   Lines:   0.00% (  0/  4)
Tipoff\Support\Transformers\BaseTransformer
  Methods:  ( 0/ 0)   Lines:  (  0/  0)
Tipoff\Support\View\Components\Money
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% (  6/  6)

@Kenny-MWI Kenny-MWI changed the title Improvements to Test Coverage Improvements to Test Coverage #2 Apr 14, 2021
@Kenny-MWI Kenny-MWI changed the title Improvements to Test Coverage #2 Improvements to Test Coverage Apr 14, 2021
class AppliesToTest extends TestCase
{
/** @test */
public function can_get_array_of_options()
Copy link
Contributor

Choose a reason for hiding this comment

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

This test (and the same test on LayoutType) should really be combined into a single test on BaseEnum since that's where the code lives. There's no code in the actual enums themselves. so really don't need a distinct test case for any of them once the base is covered.

Copy link
Member

Choose a reason for hiding this comment

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

@Kenny-MWI Could you make this update in a new PR? I'm going to go ahead and merge this one.

Copy link
Contributor

@pdbreen pdbreen left a comment

Choose a reason for hiding this comment

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

Added a comment that can improve it, but its ok as it is.

Copy link
Member

@drewroberts drewroberts left a comment

Choose a reason for hiding this comment

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

Thank you! 🎹

@drewroberts drewroberts merged commit b1fa386 into main Apr 15, 2021
@drewroberts drewroberts deleted the kenny-mwi/tests/2-improved-test-coverage branch April 15, 2021 17:09
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.

3 participants