mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-07 23:03:00 +03:00
Added more tests to increase test coverage
This commit is contained in:
@@ -31,11 +31,7 @@ abstract class Entity extends Model
|
||||
|
||||
if ($matches) return true;
|
||||
|
||||
if ($entity->isA('chapter') && $this->isA('book')) {
|
||||
return $entity->book_id === $this->id;
|
||||
}
|
||||
|
||||
if ($entity->isA('page') && $this->isA('book')) {
|
||||
if (($entity->isA('chapter') || $entity->isA('page')) && $this->isA('book')) {
|
||||
return $entity->book_id === $this->id;
|
||||
}
|
||||
|
||||
@@ -64,15 +60,6 @@ abstract class Entity extends Model
|
||||
return $this->morphMany('BookStack\View', 'viewable');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get just the views for the current user.
|
||||
* @return mixed
|
||||
*/
|
||||
public function userViews()
|
||||
{
|
||||
return $this->views()->where('user_id', '=', auth()->user()->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows checking of the exact class, Used to check entity type.
|
||||
* Cleaner method for is_a.
|
||||
|
Reference in New Issue
Block a user