Skip to content

Commit 8c5102c

Browse files
committed
Fix #1 and added gitattributes file
1 parent 8e515df commit 8c5102c

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
* text=auto
2+
3+
/.github export-ignore
4+
/tests export-ignore
5+
.gitattributes export-ignore
6+
.gitignore export-ignore
7+
phpunit.xml export-ignore

.phpunit.result.cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
C:37:"PHPUnit\Runner\DefaultTestResultCache":406:{a:2:{s:7:"defects";a:0:{}s:5:"times";a:4:{s:49:"Ownable\Tests\OwnsModelsTraitTest::testOwnsMethod";d:0.115;s:54:"Ownable\Tests\OwnsModelsTraitTest::testdoesntOwnMethod";d:0.01;s:102:"Ownable\Tests\OwnsModelsTraitTest::testItShouldUseTheInterfaceImplementationIfClassImplementsInterface";d:0.012;s:93:"Ownable\Tests\OwnsModelsTraitTest::testItShouldOverrideTheContractAndUserTheRegularValidation";d:0.009;}}}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ $video = Video::first();
5454
if ($user->owns($video)){}
5555

5656
// Check If the user doesn't owns the video
57-
if ($user->doesntOwns($video)){}
57+
if ($user->doesntOwn($video)){}
5858

5959
// Check If the user owns the video but the foreign key is the_user_id
6060
if ($user->owns($video, 'the_user_id')){}

src/OwnsModels.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function owns($model, $foreignKey = null, $overrideContract = false)
3333
* @param bool $overrideContract If true the Ownable contract is implemented it won't be used.
3434
* @return bool
3535
*/
36-
public function doesntOwns($model, $foreignKey = null, $overrideContract = false)
36+
public function doesntOwn($model, $foreignKey = null, $overrideContract = false)
3737
{
3838
return !$this->owns($model, $foreignKey);
3939
}

tests/OwnsModelsTraitTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ public function testOwnsMethod()
3434
$this->assertFalse($user->owns($posts->last()));
3535
}
3636

37-
public function testDoesntOwnsMethod()
37+
public function testdoesntOwnMethod()
3838
{
3939
$user = User::first();
4040
$posts = Post::all();
4141

42-
$this->assertFalse($user->doesntOwns($posts->first()));
43-
$this->assertTrue($user->doesntOwns($posts->last()));
44-
$this->assertTrue($user->doesntOwns($posts->first(), 'other_key'));
42+
$this->assertFalse($user->doesntOwn($posts->first()));
43+
$this->assertTrue($user->doesntOwn($posts->last()));
44+
$this->assertTrue($user->doesntOwn($posts->first(), 'other_key'));
4545
}
4646

4747
public function testItShouldUseTheInterfaceImplementationIfClassImplementsInterface()
@@ -60,6 +60,6 @@ public function testItShouldOverrideTheContractAndUserTheRegularValidation()
6060

6161
$this->assertFalse($user->owns($otherModels->first(), null, true));
6262
$this->assertFalse($user->owns($otherModels->last(), null, true));
63-
$this->assertTrue($user->doesntOwns($otherModels->last(), null, true));
63+
$this->assertTrue($user->doesntOwn($otherModels->last(), null, true));
6464
}
6565
}

0 commit comments

Comments
 (0)