@@ -19,7 +19,7 @@ abstract class AbstractHistogramTest extends TestCase
1919 */
2020 public $ adapter ;
2121
22- public function setUp ()
22+ public function setUp (): void
2323 {
2424 $ this ->configureAdapter ();
2525 }
@@ -374,51 +374,51 @@ public function itShouldProvideDefaultBuckets()
374374
375375 /**
376376 * @test
377- * @expectedException InvalidArgumentException
378- * @expectedExceptionMessage Histogram buckets must be in increasing order
379377 */
380378 public function itShouldThrowAnExceptionWhenTheBucketSizesAreNotIncreasing ()
381379 {
380+ $ this ->expectException (InvalidArgumentException::class);
381+ $ this ->expectExceptionMessage ('Histogram buckets must be in increasing order ' );
382382 new Histogram ($ this ->adapter , 'test ' , 'some_metric ' , 'this is for testing ' , [], [1 , 1 ]);
383383 }
384384
385385 /**
386386 * @test
387- * @expectedException InvalidArgumentException
388- * @expectedExceptionMessage Histogram must have at least one bucket
389387 */
390388 public function itShouldThrowAnExceptionWhenThereIsLessThanOneBucket ()
391389 {
390+ $ this ->expectException (InvalidArgumentException::class);
391+ $ this ->expectExceptionMessage ('Histogram must have at least one bucket ' );
392392 new Histogram ($ this ->adapter , 'test ' , 'some_metric ' , 'this is for testing ' , [], []);
393393 }
394394
395395 /**
396396 * @test
397- * @expectedException InvalidArgumentException
398- * @expectedExceptionMessage Histogram cannot have a label named
399397 */
400398 public function itShouldThrowAnExceptionWhenThereIsALabelNamedLe ()
401399 {
400+ $ this ->expectException (InvalidArgumentException::class);
401+ $ this ->expectExceptionMessage ('Histogram cannot have a label named ' );
402402 new Histogram ($ this ->adapter , 'test ' , 'some_metric ' , 'this is for testing ' , ['le ' ], [1 ]);
403403 }
404404
405405 /**
406406 * @test
407- * @expectedException InvalidArgumentException
408- * @expectedExceptionMessage Invalid metric name
409407 */
410408 public function itShouldRejectInvalidMetricsNames ()
411409 {
410+ $ this ->expectException (InvalidArgumentException::class);
411+ $ this ->expectExceptionMessage ('Invalid metric name ' );
412412 new Histogram ($ this ->adapter , 'test ' , 'some invalid metric ' , 'help ' , [], [1 ]);
413413 }
414414
415415 /**
416416 * @test
417- * @expectedException InvalidArgumentException
418- * @expectedExceptionMessage Invalid label name
419417 */
420418 public function itShouldRejectInvalidLabelNames ()
421419 {
420+ $ this ->expectException (InvalidArgumentException::class);
421+ $ this ->expectExceptionMessage ('Invalid label name ' );
422422 new Histogram ($ this ->adapter , 'test ' , 'some_metric ' , 'help ' , ['invalid label ' ], [1 ]);
423423 }
424424
@@ -435,20 +435,20 @@ public function isShouldAcceptAnySequenceOfBasicLatinCharactersForLabelValues($v
435435 $ histogram ->observe (1 , [$ value ]);
436436
437437 $ metrics = $ this ->adapter ->collect ();
438- self :: assertInternalType ( ' array ' , $ metrics );
439- self :: assertCount (1 , $ metrics );
440- self :: assertContainsOnlyInstancesOf (MetricFamilySamples::class, $ metrics );
438+ $ this -> assertIsArray ( $ metrics );
439+ $ this -> assertCount (1 , $ metrics );
440+ $ this -> assertContainsOnlyInstancesOf (MetricFamilySamples::class, $ metrics );
441441
442442 $ metric = reset ($ metrics );
443443 $ samples = $ metric ->getSamples ();
444- self :: assertContainsOnlyInstancesOf (Sample::class, $ samples );
444+ $ this -> assertContainsOnlyInstancesOf (Sample::class, $ samples );
445445
446446 foreach ($ samples as $ sample ) {
447447 $ labels = array_combine (
448448 array_merge ($ metric ->getLabelNames (), $ sample ->getLabelNames ()),
449449 $ sample ->getLabelValues ()
450450 );
451- self :: assertEquals ($ value , $ labels [$ label ]);
451+ $ this -> assertEquals ($ value , $ labels [$ label ]);
452452 }
453453 }
454454
@@ -480,7 +480,7 @@ public function itShouldBeAbleToGenerateExponentialBucketsGivenSpecificBounds()
480480 9.7309753417969 ,
481481 ];
482482
483- self :: assertEquals ($ generatedBuckets , $ expectedBuckets );
483+ $ this -> assertEquals ($ generatedBuckets , $ expectedBuckets );
484484 }
485485
486486 /**
0 commit comments