Skip to content

Commit 181f8d5

Browse files
authored
Initial commit fixes. (#2)
1 parent f9fe6dc commit 181f8d5

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

config/rating.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
'models' => [
10-
'rating' => \Rennokki\Rating\Models\RatingModel::class,
10+
'rating' => \Rennokki\Rating\Models\RaterModel::class,
1111
],
1212

1313
];

src/Models/RaterModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Illuminate\Database\Eloquent\Model;
66

7-
class RatingModel extends Model
7+
class RaterModel extends Model
88
{
99
protected $table = 'ratings';
1010
protected $fillable = [

src/Traits/CanBeRated.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ public function raters($model = null)
2020

2121
/**
2222
* Calculate the average rating of the current model.
23-
*
24-
* @return float The average rating.
23+
*
24+
* @return float The average rating.
2525
*/
2626
public function averageRating($model = null)
2727
{
28-
if($this->raters($model)->count() == 0) {
28+
if ($this->raters($model)->count() == 0) {
2929
return 0.00;
3030
}
3131

tests/RatingTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function testAverageRating3()
184184
public function testAverageRating4()
185185
{
186186
$this->user->rate($this->page, 1.00);
187-
$this->user2->rate($this->page, 2.00);;
187+
$this->user2->rate($this->page, 2.00);
188188

189189
$this->assertEquals($this->page->averageRating(), 0.00);
190190
$this->assertEquals($this->page->averageRating(User::class), 1.50);
@@ -197,7 +197,7 @@ public function testAverageRating5()
197197
$this->user3->rate($this->page, 10.00);
198198

199199
$this->assertEquals($this->page->averageRating(), 0.00);
200-
$this->assertEquals($this->page->averageRating(User::class), (12.00/3));
200+
$this->assertEquals($this->page->averageRating(User::class), (12.00 / 3));
201201
}
202202

203203
public function testAverageRating6()
@@ -207,6 +207,6 @@ public function testAverageRating6()
207207
$this->user3->rate($this->page, 5.77);
208208

209209
$this->assertEquals($this->page->averageRating(), 0.00);
210-
$this->assertEquals($this->page->averageRating(User::class), ((7.43+3.15+5.77)/3));
210+
$this->assertEquals($this->page->averageRating(User::class), ((7.43 + 3.15 + 5.77) / 3));
211211
}
212212
}

tests/TestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Rennokki\Rating\Test;
44

55
use Rennokki\Rating\Test\Models\User;
6-
use Rennokki\Rating\Models\RatingModel;
6+
use Rennokki\Rating\Models\RaterModel;
77
use Rennokki\Rating\Test\Models\Pages;
88
use Orchestra\Testbench\TestCase as Orchestra;
99

@@ -41,7 +41,7 @@ public function getEnvironmentSetUp($app)
4141
$app['config']->set('auth.providers.users.model', User::class);
4242
$app['config']->set('auth.providers.pages.model', Page::class);
4343
$app['config']->set('app.key', 'wslxrEFGWY6GfGhvN9L3wH3KSRJQQpBD');
44-
$app['config']->set('rating.models.rating', RatingModel::class);
44+
$app['config']->set('rating.models.rating', RaterModel::class);
4545
}
4646

4747
protected function resetDatabase()

0 commit comments

Comments
 (0)