File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -70,10 +70,14 @@ public function getName(): string
70
70
* Sets the name of this transaction.
71
71
*
72
72
* @param string $name The name
73
+ *
74
+ * @return $this
73
75
*/
74
- public function setName (string $ name ): void
76
+ public function setName (string $ name ): self
75
77
{
76
78
$ this ->name = $ name ;
79
+
80
+ return $ this ;
77
81
}
78
82
79
83
/**
Original file line number Diff line number Diff line change @@ -86,6 +86,18 @@ public function testFinishDoesNothingIfSampledFlagIsNotTrue(): void
86
86
$ transaction ->finish ();
87
87
}
88
88
89
+ public function testFluentApi (): void
90
+ {
91
+ $ transaction = new Transaction (TransactionContext::make ());
92
+ $ tags = ['foo ' => 'bar ' ];
93
+ $ name = 'baz ' ;
94
+ $ transaction ->setTags ($ tags )
95
+ ->setName ($ name )
96
+ ->finish ();
97
+ $ this ->assertSame ($ tags , $ transaction ->getTags ());
98
+ $ this ->assertSame ($ name , $ transaction ->getName ());
99
+ }
100
+
89
101
/**
90
102
* @dataProvider parentTransactionContextDataProvider
91
103
*/
You can’t perform that action at this time.
0 commit comments