Skip to content

Commit 2aaa162

Browse files
committed
add test case for delete hook
1 parent 38d2a8d commit 2aaa162

File tree

1 file changed

+15
-0
lines changed
  • src/Instrumentation/Laravel/tests/Integration/Database/Eloquent

1 file changed

+15
-0
lines changed

src/Instrumentation/Laravel/tests/Integration/Database/Eloquent/ModelTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,21 @@ public function test_perform_update(): void
128128
$this->assertSame('update', $span->getAttributes()->get('laravel.eloquent.operation'));
129129
}
130130

131+
public function test_delete(): void
132+
{
133+
$model = new TestModel();
134+
$model->delete(); // no effect
135+
136+
$spans = $this->filterOnlyEloquentSpans();
137+
$this->assertCount(1, $spans);
138+
139+
$span = $spans[0];
140+
$this->assertSame('OpenTelemetry\Tests\Contrib\Instrumentation\Laravel\Fixtures\Models\TestModel::delete', $span->getName());
141+
$this->assertSame('OpenTelemetry\Tests\Contrib\Instrumentation\Laravel\Fixtures\Models\TestModel', $span->getAttributes()->get('laravel.eloquent.model'));
142+
$this->assertSame('test_models', $span->getAttributes()->get('laravel.eloquent.table'));
143+
$this->assertSame('delete', $span->getAttributes()->get('laravel.eloquent.operation'));
144+
}
145+
131146
public function test_get_models(): void
132147
{
133148
TestModel::get();

0 commit comments

Comments
 (0)