Passed
Pull Request — next (#160)
by Bas
04:08
created

InteractsWithDatabase::assertDatabaseHas()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 10
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LaravelFreelancerNL\Aranguent\Testing\Concerns;
6
7
use Illuminate\Support\Facades\DB;
8
9
trait InteractsWithDatabase
10
{
11
    /**
12
     * Cast a JSON string to a database compatible type.
13
     * Supported for backwards compatibility in existing projects.
14
     * No cast is necessary as json is a first class citizen in ArangoDB.
15
     *
16
     * @param  array<mixed>|object|string  $value
17
     * @return \Illuminate\Contracts\Database\Query\Expression
18
     */
19 1
    public function castAsJson($value)
20
    {
21 1
        return DB::raw($value);
22
    }
23
}
24