Skip to content

Commit 6451928

Browse files
derrabusfabpot
authored andcommitted
Modernized deprecated PHPUnit assertion calls
1 parent a509598 commit 6451928

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

Tests/DataCollector/ConfigDataCollectorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public function testCollect()
3131
$this->assertTrue($c->isDebug());
3232
$this->assertSame('config', $c->getName());
3333
$this->assertSame('testkernel', $c->getAppName());
34-
$this->assertRegExp('~^'.preg_quote($c->getPhpVersion(), '~').'~', PHP_VERSION);
35-
$this->assertRegExp('~'.preg_quote((string) $c->getPhpVersionExtra(), '~').'$~', PHP_VERSION);
34+
$this->assertMatchesRegularExpression('~^'.preg_quote($c->getPhpVersion(), '~').'~', PHP_VERSION);
35+
$this->assertMatchesRegularExpression('~'.preg_quote((string) $c->getPhpVersionExtra(), '~').'$~', PHP_VERSION);
3636
$this->assertSame(PHP_INT_SIZE * 8, $c->getPhpArchitecture());
3737
$this->assertSame(class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', $c->getPhpIntlLocale());
3838
$this->assertSame(date_default_timezone_get(), $c->getPhpTimezone());

Tests/HttpCache/HttpCacheTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformation()
654654
$this->assertTraceContains('miss');
655655
$this->assertTraceContains('store');
656656
$this->assertEquals('Hello World', $this->response->getContent());
657-
$this->assertRegExp('/s-maxage=10/', $this->response->headers->get('Cache-Control'));
657+
$this->assertMatchesRegularExpression('/s-maxage=10/', $this->response->headers->get('Cache-Control'));
658658

659659
$this->cacheConfig['default_ttl'] = 10;
660660
$this->request('GET', '/');
@@ -663,7 +663,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformation()
663663
$this->assertTraceContains('fresh');
664664
$this->assertTraceNotContains('store');
665665
$this->assertEquals('Hello World', $this->response->getContent());
666-
$this->assertRegExp('/s-maxage=10/', $this->response->headers->get('Cache-Control'));
666+
$this->assertMatchesRegularExpression('/s-maxage=10/', $this->response->headers->get('Cache-Control'));
667667
}
668668

669669
public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAfterTtlWasExpired()
@@ -676,15 +676,15 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft
676676
$this->assertTraceContains('miss');
677677
$this->assertTraceContains('store');
678678
$this->assertEquals('Hello World', $this->response->getContent());
679-
$this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
679+
$this->assertMatchesRegularExpression('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
680680

681681
$this->request('GET', '/');
682682
$this->assertHttpKernelIsNotCalled();
683683
$this->assertEquals(200, $this->response->getStatusCode());
684684
$this->assertTraceContains('fresh');
685685
$this->assertTraceNotContains('store');
686686
$this->assertEquals('Hello World', $this->response->getContent());
687-
$this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
687+
$this->assertMatchesRegularExpression('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
688688

689689
// expires the cache
690690
$values = $this->getMetaStorageValues();
@@ -704,7 +704,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft
704704
$this->assertTraceContains('invalid');
705705
$this->assertTraceContains('store');
706706
$this->assertEquals('Hello World', $this->response->getContent());
707-
$this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
707+
$this->assertMatchesRegularExpression('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
708708

709709
$this->setNextResponse();
710710

@@ -714,7 +714,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft
714714
$this->assertTraceContains('fresh');
715715
$this->assertTraceNotContains('store');
716716
$this->assertEquals('Hello World', $this->response->getContent());
717-
$this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
717+
$this->assertMatchesRegularExpression('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
718718
}
719719

720720
public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAfterTtlWasExpiredWithStatus304()
@@ -727,7 +727,7 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft
727727
$this->assertTraceContains('miss');
728728
$this->assertTraceContains('store');
729729
$this->assertEquals('Hello World', $this->response->getContent());
730-
$this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
730+
$this->assertMatchesRegularExpression('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
731731

732732
$this->request('GET', '/');
733733
$this->assertHttpKernelIsNotCalled();
@@ -755,15 +755,15 @@ public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAft
755755
$this->assertTraceContains('store');
756756
$this->assertTraceNotContains('miss');
757757
$this->assertEquals('Hello World', $this->response->getContent());
758-
$this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
758+
$this->assertMatchesRegularExpression('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
759759

760760
$this->request('GET', '/');
761761
$this->assertHttpKernelIsNotCalled();
762762
$this->assertEquals(200, $this->response->getStatusCode());
763763
$this->assertTraceContains('fresh');
764764
$this->assertTraceNotContains('store');
765765
$this->assertEquals('Hello World', $this->response->getContent());
766-
$this->assertRegExp('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
766+
$this->assertMatchesRegularExpression('/s-maxage=(2|3)/', $this->response->headers->get('Cache-Control'));
767767
}
768768

769769
public function testDoesNotAssignDefaultTtlWhenResponseHasMustRevalidateDirective()
@@ -776,7 +776,7 @@ public function testDoesNotAssignDefaultTtlWhenResponseHasMustRevalidateDirectiv
776776
$this->assertEquals(200, $this->response->getStatusCode());
777777
$this->assertTraceContains('miss');
778778
$this->assertTraceNotContains('store');
779-
$this->assertNotRegExp('/s-maxage/', $this->response->headers->get('Cache-Control'));
779+
$this->assertDoesNotMatchRegularExpression('/s-maxage/', $this->response->headers->get('Cache-Control'));
780780
$this->assertEquals('Hello World', $this->response->getContent());
781781
}
782782

Tests/HttpCache/HttpCacheTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ public function assertTraceContains($trace)
9191
$traces = $this->cache->getTraces();
9292
$traces = current($traces);
9393

94-
$this->assertRegExp('/'.$trace.'/', implode(', ', $traces));
94+
$this->assertMatchesRegularExpression('/'.$trace.'/', implode(', ', $traces));
9595
}
9696

9797
public function assertTraceNotContains($trace)
9898
{
9999
$traces = $this->cache->getTraces();
100100
$traces = current($traces);
101101

102-
$this->assertNotRegExp('/'.$trace.'/', implode(', ', $traces));
102+
$this->assertDoesNotMatchRegularExpression('/'.$trace.'/', implode(', ', $traces));
103103
}
104104

105105
public function assertExceptionsAreCaught()

Tests/KernelTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,16 @@ public function testInitializeContainerClearsOldContainers()
7878
$containerDir = __DIR__.'/Fixtures/cache/custom/'.substr(\get_class($kernel->getContainer()), 0, 16);
7979
$this->assertTrue(unlink(__DIR__.'/Fixtures/cache/custom/FixturesCustomDebugProjectContainer.php.meta'));
8080
$this->assertFileExists($containerDir);
81-
$this->assertFileNotExists($containerDir.'.legacy');
81+
$this->assertFileDoesNotExist($containerDir.'.legacy');
8282

8383
$kernel = new CustomProjectDirKernel(function ($container) { $container->register('foo', 'stdClass')->setPublic(true); });
8484
$kernel->boot();
8585

8686
$this->assertFileExists($containerDir);
8787
$this->assertFileExists($containerDir.'.legacy');
8888

89-
$this->assertFileNotExists($legacyContainerDir);
90-
$this->assertFileNotExists($legacyContainerDir.'.legacy');
89+
$this->assertFileDoesNotExist($legacyContainerDir);
90+
$this->assertFileDoesNotExist($legacyContainerDir.'.legacy');
9191
}
9292

9393
public function testBootInitializesBundlesAndContainer()

0 commit comments

Comments
 (0)