Improve test coverage.

This commit is contained in:
James Cole
2019-08-02 05:25:24 +02:00
parent 4bd8e1b11e
commit fc70afa3ea
23 changed files with 202 additions and 57923 deletions

View File

@@ -82,17 +82,12 @@ class TagFactory
public function findOrCreate(string $tag): ?Tag
{
$tag = trim($tag);
if (null === $this->tags) {
$this->tags = $this->user->tags()->get();
}
/** @var Tag $object */
foreach ($this->tags as $object) {
if (strtolower($object->tag) === strtolower($tag)) {
return $object;
}
/** @var Tag $dbTag */
$dbTag = $this->user->tags()->where('tag', $tag)->first();
if (null !== $tag) {
return $dbTag;
}
$newTag = $this->create(
[
'tag' => $tag,
@@ -103,7 +98,6 @@ class TagFactory
'zoom_level' => null,
]
);
$this->tags->push($newTag);
return $newTag;
}