forked from tursodatabase/libsql-laravel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlobDataTest.php
48 lines (35 loc) · 1.14 KB
/
BlobDataTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
beforeEach(function () {
Schema::create('blob_table', function ($table) {
$table->id();
$table->binary('blob');
});
});
afterEach(function () {
Schema::dropIfExists('blob_table');
});
test('it can insert a new blob data', function () {
$data = random_bytes(50);
$result = DB::table('blob_table')->insert([
'blob' => $data,
]);
$newData = DB::table('blob_table')->first();
expect($result)->toBeTrue()
->and(DB::table('blob_table')->count())->toBe(1)
->and($newData->blob)->toBe($data);
})->group('BlobDataTest', 'DataTypes', 'FeatureTest');
test('it can update an existing blob data', function () {
$data = random_bytes(50);
DB::table('blob_table')->insert([
'blob' => $data,
]);
$newData = random_bytes(50);
$result = DB::table('blob_table')->update([
'blob' => $newData,
]);
$updatedData = DB::table('blob_table')->first();
expect($result)->toBe(1)
->and($updatedData->blob)->toBe($newData);
})->group('BlobDataTest', 'DataTypes', 'FeatureTest');