1
0
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:
Dan Brown
2016-01-02 14:48:35 +00:00
parent f60a0c3b76
commit d3709de035
10 changed files with 97 additions and 33 deletions

View File

@@ -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.