Skip to content

Commit

Permalink
Replace EntityWithMorphMap with MorphMappedReactable stub (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkomarev authored Jan 30, 2020
1 parent 46a37f2 commit 44aa6e8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 77 deletions.
40 changes: 0 additions & 40 deletions tests/Stubs/Models/EntityWithMorphMap.php

This file was deleted.

2 changes: 0 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
namespace Cog\Tests\Laravel\Love;

use Cog\Laravel\Love\LoveServiceProvider;
use Cog\Tests\Laravel\Love\Stubs\Models\EntityWithMorphMap;
use Cog\Tests\Laravel\Love\Stubs\Models\MorphMappedReactable;
use Cog\Tests\Laravel\Love\Stubs\Models\MorphMappedReacterable;
use Cog\Tests\Laravel\Love\Stubs\Models\User;
Expand Down Expand Up @@ -103,7 +102,6 @@ private function registerPackageFactories(): void
private function registerTestMorphMaps(): void
{
Relation::morphMap([
'entity-with-morph-map' => EntityWithMorphMap::class,
'morph-mapped-reactable' => MorphMappedReactable::class,
'morph-mapped-reacterable' => MorphMappedReacterable::class,
]);
Expand Down
26 changes: 13 additions & 13 deletions tests/Unit/Console/Commands/RecountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
use Cog\Tests\Laravel\Love\Stubs\Models\Article;
use Cog\Tests\Laravel\Love\Stubs\Models\Bot;
use Cog\Tests\Laravel\Love\Stubs\Models\Entity;
use Cog\Tests\Laravel\Love\Stubs\Models\EntityWithMorphMap;
use Cog\Tests\Laravel\Love\Stubs\Models\MorphMappedReactable;
use Cog\Tests\Laravel\Love\TestCase;

final class RecountTest extends TestCase
Expand Down Expand Up @@ -235,7 +235,7 @@ public function it_can_recount_reactions_of_one_reaction_type_for_one_reactable_
ReactionCounter::query()->truncate();

$status = $this->artisan('love:recount', [
'--model' => 'entity-with-morph-map',
'--model' => 'morph-mapped-reactable',
'--type' => 'Like',
]);

Expand Down Expand Up @@ -278,7 +278,7 @@ public function it_can_recount_reactions_of_one_reaction_type_for_one_reactable_
] = $this->seedTestData();

$status = $this->artisan('love:recount', [
'--model' => 'entity-with-morph-map',
'--model' => 'morph-mapped-reactable',
'--type' => 'Like',
]);

Expand Down Expand Up @@ -322,7 +322,7 @@ public function it_can_recount_reactions_of_one_reaction_type_for_one_reactable_
ReactionCounter::query()->truncate();

$status = $this->artisan('love:recount', [
'--model' => EntityWithMorphMap::class,
'--model' => MorphMappedReactable::class,
'--type' => 'Like',
]);

Expand Down Expand Up @@ -365,7 +365,7 @@ public function it_can_recount_reactions_of_one_reaction_type_for_one_reactable_
] = $this->seedTestData();

$status = $this->artisan('love:recount', [
'--model' => EntityWithMorphMap::class,
'--model' => MorphMappedReactable::class,
'--type' => 'Like',
]);

Expand Down Expand Up @@ -579,7 +579,7 @@ public function it_can_recount_reactions_of_any_reaction_type_for_one_reactable_
ReactionCounter::query()->truncate();

$status = $this->artisan('love:recount', [
'--model' => 'entity-with-morph-map',
'--model' => 'morph-mapped-reactable',
]);

$counters = ReactionCounter::query()->count();
Expand Down Expand Up @@ -622,7 +622,7 @@ public function it_can_recount_reactions_of_any_reaction_type_for_one_reactable_
] = $this->seedTestData();

$status = $this->artisan('love:recount', [
'--model' => 'entity-with-morph-map',
'--model' => 'morph-mapped-reactable',
]);

$counters = ReactionCounter::query()->count();
Expand Down Expand Up @@ -666,7 +666,7 @@ public function it_can_recount_reactions_of_any_reaction_type_for_one_reactable_
ReactionCounter::query()->truncate();

$status = $this->artisan('love:recount', [
'--model' => EntityWithMorphMap::class,
'--model' => MorphMappedReactable::class,
]);

$counters = ReactionCounter::query()->count();
Expand Down Expand Up @@ -709,7 +709,7 @@ public function it_can_recount_reactions_of_any_reaction_type_for_one_reactable_
] = $this->seedTestData();

$status = $this->artisan('love:recount', [
'--model' => EntityWithMorphMap::class,
'--model' => MorphMappedReactable::class,
]);

$counters = ReactionCounter::query()->count();
Expand Down Expand Up @@ -988,11 +988,11 @@ private function seedTestData(): array
{
$reactant1 = factory(Entity::class)->create()
->getLoveReactant();
$reactant2 = factory(EntityWithMorphMap::class)->create()
$reactant2 = factory(MorphMappedReactable::class)->create()
->getLoveReactant();
$reactant3 = factory(Article::class)->create()
->getLoveReactant();
$reactant4 = factory(EntityWithMorphMap::class)->create()
$reactant4 = factory(MorphMappedReactable::class)->create()
->getLoveReactant();

$reacter1 = factory(Reacter::class)->create();
Expand All @@ -1019,9 +1019,9 @@ private function seedTestData(): array

return [
$reactant1, // 3 likes | 0 dislikes | Entity
$reactant2, // 2 likes | 1 dislikes | EntityWithMorphMap
$reactant2, // 2 likes | 1 dislikes | MorphMappedReactable
$reactant3, // 2 likes | 2 dislikes | Article
$reactant4, // 1 likes | 2 dislikes | EntityWithMorphMap
$reactant4, // 1 likes | 2 dislikes | MorphMappedReactable
];
}
}
22 changes: 0 additions & 22 deletions tests/database/factories/EntityWithMorphMap.php

This file was deleted.

0 comments on commit 44aa6e8

Please sign in to comment.