Skip to content

Commit

Permalink
Tests for not enabled tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
freezy-sk committed Mar 28, 2019
1 parent a69b7a6 commit 63b5e24
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/ActiveRecordBehaviorIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ public function testTraceSave()
$activeRecord->save();
}

public function testTraceSaveDisabled()
{
$opentracingMock = $this->createApplicationWithMockedOpentracingComponent();
$opentracingMock->expects($this->never())->method('startActiveSpan');

$activeRecord = new TestActiveRecord();
$activeRecord->opentracingBehavior->traceSave = false;
$activeRecord->id = 100;
$activeRecord->save();
$activeRecord->opentracingBehavior->traceSave = true;
}

public function testTraceDelete()
{
$findScopeMock = $this->mockScope();
Expand All @@ -112,6 +124,23 @@ public function testTraceDelete()
$activeRecord->delete();
}

public function testTraceDeleteDisabled()
{
$opentracingMock = $this->createApplicationWithMockedOpentracingComponent();
$opentracingMock->expects($this->never())
->method('startActiveSpan')
->with($this->stringContains('DELETE'));

TestActiveRecord::model()->opentracingBehavior->traceFind = false;

$activeRecord = TestActiveRecord::model()->findByPk(1);
$activeRecord->opentracingBehavior->traceDelete = false;
$activeRecord->delete();
$activeRecord->opentracingBehavior->traceDelete = true;

TestActiveRecord::model()->opentracingBehavior->traceFind = true;
}

/**
* @return MockObject|OpenTracing
*/
Expand Down

0 comments on commit 63b5e24

Please sign in to comment.