Skip to content

Commit e77e46c

Browse files
authored
Merge pull request #25 from veelasky/patch
Add More Test for basic model
2 parents 22e4235 + c8d26c3 commit e77e46c

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

codecov.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
informational: true
6+
patch:
7+
default:
8+
informational: true
9+
comment:
10+
layout: "reach, diff, flags"
11+
require_changes: true

tests/Models/BasicModel.php

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Tests\Models;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
7+
class BasicModel extends Model
8+
{
9+
protected $table = 'hashid_test';
10+
protected static $unguarded = true;
11+
}

tests/Models/HashModel.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22

33
namespace Tests\Models;
44

5-
use Illuminate\Database\Eloquent\Model;
65
use Veelasky\LaravelHashId\Eloquent\HashableId;
76

8-
class HashModel extends Model
7+
class HashModel extends BasicModel
98
{
109
use HashableId;
11-
12-
protected $table = 'hashid_test';
13-
protected static $unguarded = true;
1410
}

tests/Unit/HashableIdModelTest.php

+8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Support\Facades\Validator;
88
use Illuminate\Support\Str;
99
use Illuminate\Validation\ValidationException;
10+
use Tests\Models\BasicModel;
1011
use Tests\Models\CustomKeyModel;
1112
use Tests\Models\CustomSaltModel;
1213
use Tests\Models\HashModel;
@@ -181,6 +182,13 @@ public function test_route_binding()
181182

182183
$resolved = $m->resolveRouteBinding($m->hash);
183184
$this->assertTrue($resolved->is($m));
185+
186+
// revert to original
187+
$m = new BasicModel();
188+
$m->save();
189+
190+
$resolved = $m->resolveRouteBinding($m->getKey());
191+
$this->assertTrue($resolved->is($m));
184192
}
185193

186194
protected function getRepository(): Repository

0 commit comments

Comments
 (0)