minor #37831 stop using deprecated PHPUnit APIs (xabbuh)
This PR was merged into the 4.4 branch.
Discussion
----------
stop using deprecated PHPUnit APIs
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Commits
-------
3d209c46e4
stop using deprecated PHPUnit APIs
This commit is contained in:
commit
dbe4e83ae6
@ -91,7 +91,7 @@ class LintCommandTest extends TestCase
|
||||
$ret = $tester->execute(['filename' => [$filename], '--show-deprecations' => true], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]);
|
||||
|
||||
$this->assertEquals(1, $ret, 'Returns 1 in case of error');
|
||||
$this->assertRegExp('/ERROR in \S+ \(line 1\)/', trim($tester->getDisplay()));
|
||||
$this->assertMatchesRegularExpression('/ERROR in \S+ \(line 1\)/', trim($tester->getDisplay()));
|
||||
$this->assertStringContainsString('Filter "deprecated_filter" is deprecated', trim($tester->getDisplay()));
|
||||
}
|
||||
|
||||
|
@ -78,8 +78,8 @@ class TranslationDebugCommandTest extends TestCase
|
||||
$tester = $this->createCommandTester(['foo' => 'foo'], ['bar' => 'bar']);
|
||||
$tester->execute(['locale' => 'en']);
|
||||
|
||||
$this->assertRegExp('/missing/', $tester->getDisplay());
|
||||
$this->assertRegExp('/unused/', $tester->getDisplay());
|
||||
$this->assertMatchesRegularExpression('/missing/', $tester->getDisplay());
|
||||
$this->assertMatchesRegularExpression('/unused/', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testDebugDefaultRootDirectory()
|
||||
|
@ -36,31 +36,31 @@ class TranslationUpdateCommandTest extends TestCase
|
||||
{
|
||||
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'test' => 'test', 'bar' => 'bar']]);
|
||||
$tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true, '--sort' => 'asc']);
|
||||
$this->assertRegExp("/\*bar\*foo\*test/", preg_replace('/\s+/', '', $tester->getDisplay()));
|
||||
$this->assertRegExp('/3 messages were successfully extracted/', $tester->getDisplay());
|
||||
$this->assertMatchesRegularExpression("/\*bar\*foo\*test/", preg_replace('/\s+/', '', $tester->getDisplay()));
|
||||
$this->assertMatchesRegularExpression('/3 messages were successfully extracted/', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testDumpReverseSortedMessagesAndClean()
|
||||
{
|
||||
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'test' => 'test', 'bar' => 'bar']]);
|
||||
$tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true, '--sort' => 'desc']);
|
||||
$this->assertRegExp("/\*test\*foo\*bar/", preg_replace('/\s+/', '', $tester->getDisplay()));
|
||||
$this->assertRegExp('/3 messages were successfully extracted/', $tester->getDisplay());
|
||||
$this->assertMatchesRegularExpression("/\*test\*foo\*bar/", preg_replace('/\s+/', '', $tester->getDisplay()));
|
||||
$this->assertMatchesRegularExpression('/3 messages were successfully extracted/', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testDumpSortWithoutValueAndClean()
|
||||
{
|
||||
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'test' => 'test', 'bar' => 'bar']]);
|
||||
$tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true, '--sort']);
|
||||
$this->assertRegExp("/\*bar\*foo\*test/", preg_replace('/\s+/', '', $tester->getDisplay()));
|
||||
$this->assertRegExp('/3 messages were successfully extracted/', $tester->getDisplay());
|
||||
$this->assertMatchesRegularExpression("/\*bar\*foo\*test/", preg_replace('/\s+/', '', $tester->getDisplay()));
|
||||
$this->assertMatchesRegularExpression('/3 messages were successfully extracted/', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testDumpWrongSortAndClean()
|
||||
{
|
||||
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'test' => 'test', 'bar' => 'bar']]);
|
||||
$tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true, '--sort' => 'test']);
|
||||
$this->assertRegExp('/\[ERROR\] Wrong sort order/', $tester->getDisplay());
|
||||
$this->assertMatchesRegularExpression('/\[ERROR\] Wrong sort order/', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testDumpMessagesAndCleanInRootDirectory()
|
||||
@ -126,7 +126,7 @@ class TranslationUpdateCommandTest extends TestCase
|
||||
|
||||
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo']]);
|
||||
$tester->execute(['command' => 'translation:update', 'locale' => 'en', '--force' => true]);
|
||||
$this->assertRegExp('/Translation files were successfully updated./', $tester->getDisplay());
|
||||
$this->assertMatchesRegularExpression('/Translation files were successfully updated./', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testWriteMessagesForSpecificDomain()
|
||||
|
@ -232,19 +232,19 @@ class ApplicationTest extends TestCase
|
||||
public function testSuggestingPackagesWithExactMatch()
|
||||
{
|
||||
$result = $this->createEventForSuggestingPackages('server:dump', []);
|
||||
$this->assertRegExp('/You may be looking for a command provided by/', $result);
|
||||
$this->assertMatchesRegularExpression('/You may be looking for a command provided by/', $result);
|
||||
}
|
||||
|
||||
public function testSuggestingPackagesWithPartialMatchAndNoAlternatives()
|
||||
{
|
||||
$result = $this->createEventForSuggestingPackages('server', []);
|
||||
$this->assertRegExp('/You may be looking for a command provided by/', $result);
|
||||
$this->assertMatchesRegularExpression('/You may be looking for a command provided by/', $result);
|
||||
}
|
||||
|
||||
public function testSuggestingPackagesWithPartialMatchAndAlternatives()
|
||||
{
|
||||
$result = $this->createEventForSuggestingPackages('server', ['server:run']);
|
||||
$this->assertNotRegExp('/You may be looking for a command provided by/', $result);
|
||||
$this->assertDoesNotMatchRegularExpression('/You may be looking for a command provided by/', $result);
|
||||
}
|
||||
|
||||
private function createEventForSuggestingPackages(string $command, array $alternatives = []): string
|
||||
|
@ -417,7 +417,7 @@ class AutowirePassTest extends TestCase
|
||||
$pass->process($container);
|
||||
$this->fail('AutowirePass should have thrown an exception');
|
||||
} catch (AutowiringFailedException $e) {
|
||||
$this->assertRegExp('{^Cannot autowire service "a": argument "\$r" of method "(Symfony\\\\Component\\\\DependencyInjection\\\\Tests\\\\Compiler\\\\)BadParentTypeHintedArgument::__construct\(\)" has type "\1OptionalServiceClass" but this class is missing a parent class \(Class "?Symfony\\\\Bug\\\\NotExistClass"? not found}', (string) $e->getMessage());
|
||||
$this->assertMatchesRegularExpression('{^Cannot autowire service "a": argument "\$r" of method "(Symfony\\\\Component\\\\DependencyInjection\\\\Tests\\\\Compiler\\\\)BadParentTypeHintedArgument::__construct\(\)" has type "\1OptionalServiceClass" but this class is missing a parent class \(Class "?Symfony\\\\Bug\\\\NotExistClass"? not found}', (string) $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,11 +196,11 @@ class XmlFileLoaderTest extends TestCase
|
||||
$this->fail('->load() throws a LoaderLoadException if the imported xml file configuration does not exist');
|
||||
} catch (\Exception $e) {
|
||||
$this->assertInstanceOf('Symfony\\Component\\Config\\Exception\\LoaderLoadException', $e, '->load() throws a LoaderLoadException if the imported xml file configuration does not exist');
|
||||
$this->assertRegExp(sprintf('#^The file "%1$s" does not exist \(in: .+\) in %1$s \(which is being imported from ".+%2$s"\)\.$#', 'foo_fake\.xml', 'services4_bad_import_with_errors\.xml'), $e->getMessage(), '->load() throws a LoaderLoadException if the imported xml file configuration does not exist');
|
||||
$this->assertMatchesRegularExpression(sprintf('#^The file "%1$s" does not exist \(in: .+\) in %1$s \(which is being imported from ".+%2$s"\)\.$#', 'foo_fake\.xml', 'services4_bad_import_with_errors\.xml'), $e->getMessage(), '->load() throws a LoaderLoadException if the imported xml file configuration does not exist');
|
||||
|
||||
$e = $e->getPrevious();
|
||||
$this->assertInstanceOf('Symfony\\Component\\Config\\Exception\\FileLocatorFileNotFoundException', $e, '->load() throws a FileLocatorFileNotFoundException if the imported xml file configuration does not exist');
|
||||
$this->assertRegExp(sprintf('#^The file "%s" does not exist \(in: .+\)\.$#', 'foo_fake\.xml'), $e->getMessage(), '->load() throws a FileLocatorFileNotFoundException if the imported xml file configuration does not exist');
|
||||
$this->assertMatchesRegularExpression(sprintf('#^The file "%s" does not exist \(in: .+\)\.$#', 'foo_fake\.xml'), $e->getMessage(), '->load() throws a FileLocatorFileNotFoundException if the imported xml file configuration does not exist');
|
||||
}
|
||||
|
||||
try {
|
||||
@ -208,11 +208,11 @@ class XmlFileLoaderTest extends TestCase
|
||||
$this->fail('->load() throws an LoaderLoadException if the imported configuration does not validate the XSD');
|
||||
} catch (\Exception $e) {
|
||||
$this->assertInstanceOf('Symfony\\Component\\Config\\Exception\\LoaderLoadException', $e, '->load() throws a LoaderLoadException if the imported configuration does not validate the XSD');
|
||||
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'nonvalid\.xml'), $e->getMessage(), '->load() throws a LoaderLoadException if the imported configuration does not validate the XSD');
|
||||
$this->assertMatchesRegularExpression(sprintf('#^Unable to parse file ".+%s": .+.$#', 'nonvalid\.xml'), $e->getMessage(), '->load() throws a LoaderLoadException if the imported configuration does not validate the XSD');
|
||||
|
||||
$e = $e->getPrevious();
|
||||
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
|
||||
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'nonvalid\.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
|
||||
$this->assertMatchesRegularExpression(sprintf('#^Unable to parse file ".+%s": .+.$#', 'nonvalid\.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
|
||||
|
||||
$e = $e->getPrevious();
|
||||
$this->assertInstanceOf('Symfony\\Component\\Config\\Util\\Exception\\XmlParsingException', $e, '->load() throws a XmlParsingException if the configuration does not validate the XSD');
|
||||
|
@ -144,11 +144,11 @@ class YamlFileLoaderTest extends TestCase
|
||||
$this->fail('->load() throws a LoaderLoadException if the imported yaml file does not exist');
|
||||
} catch (\Exception $e) {
|
||||
$this->assertInstanceOf('Symfony\\Component\\Config\\Exception\\LoaderLoadException', $e, '->load() throws a LoaderLoadException if the imported yaml file does not exist');
|
||||
$this->assertRegExp(sprintf('#^The file "%1$s" does not exist \(in: .+\) in %1$s \(which is being imported from ".+%2$s"\)\.$#', 'foo_fake\.yml', 'services4_bad_import_with_errors\.yml'), $e->getMessage(), '->load() throws a LoaderLoadException if the imported yaml file does not exist');
|
||||
$this->assertMatchesRegularExpression(sprintf('#^The file "%1$s" does not exist \(in: .+\) in %1$s \(which is being imported from ".+%2$s"\)\.$#', 'foo_fake\.yml', 'services4_bad_import_with_errors\.yml'), $e->getMessage(), '->load() throws a LoaderLoadException if the imported yaml file does not exist');
|
||||
|
||||
$e = $e->getPrevious();
|
||||
$this->assertInstanceOf('Symfony\\Component\\Config\\Exception\\FileLocatorFileNotFoundException', $e, '->load() throws a FileLocatorFileNotFoundException if the imported yaml file does not exist');
|
||||
$this->assertRegExp(sprintf('#^The file "%s" does not exist \(in: .+\)\.$#', 'foo_fake\.yml'), $e->getMessage(), '->load() throws a FileLocatorFileNotFoundException if the imported yaml file does not exist');
|
||||
$this->assertMatchesRegularExpression(sprintf('#^The file "%s" does not exist \(in: .+\)\.$#', 'foo_fake\.yml'), $e->getMessage(), '->load() throws a FileLocatorFileNotFoundException if the imported yaml file does not exist');
|
||||
}
|
||||
|
||||
try {
|
||||
@ -156,11 +156,11 @@ class YamlFileLoaderTest extends TestCase
|
||||
$this->fail('->load() throws a LoaderLoadException if the tag in the imported yaml file is not valid');
|
||||
} catch (\Exception $e) {
|
||||
$this->assertInstanceOf('Symfony\\Component\\Config\\Exception\\LoaderLoadException', $e, '->load() throws a LoaderLoadException if the tag in the imported yaml file is not valid');
|
||||
$this->assertRegExp(sprintf('#^The service file ".+%1$s" is not valid\. It should contain an array\. Check your YAML syntax in .+%1$s \(which is being imported from ".+%2$s"\)\.$#', 'nonvalid2\.yml', 'services4_bad_import_nonvalid.yml'), $e->getMessage(), '->load() throws a LoaderLoadException if the tag in the imported yaml file is not valid');
|
||||
$this->assertMatchesRegularExpression(sprintf('#^The service file ".+%1$s" is not valid\. It should contain an array\. Check your YAML syntax in .+%1$s \(which is being imported from ".+%2$s"\)\.$#', 'nonvalid2\.yml', 'services4_bad_import_nonvalid.yml'), $e->getMessage(), '->load() throws a LoaderLoadException if the tag in the imported yaml file is not valid');
|
||||
|
||||
$e = $e->getPrevious();
|
||||
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tag in the imported yaml file is not valid');
|
||||
$this->assertRegExp(sprintf('#^The service file ".+%s" is not valid\. It should contain an array\. Check your YAML syntax\.$#', 'nonvalid2\.yml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the tag in the imported yaml file is not valid');
|
||||
$this->assertMatchesRegularExpression(sprintf('#^The service file ".+%s" is not valid\. It should contain an array\. Check your YAML syntax\.$#', 'nonvalid2\.yml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the tag in the imported yaml file is not valid');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,10 +93,10 @@ class ErrorHandlerTest extends TestCase
|
||||
// if an exception is thrown, the test passed
|
||||
if (\PHP_VERSION_ID < 80000) {
|
||||
$this->assertEquals(E_NOTICE, $exception->getSeverity());
|
||||
$this->assertRegExp('/^Notice: Undefined variable: (foo|bar)/', $exception->getMessage());
|
||||
$this->assertMatchesRegularExpression('/^Notice: Undefined variable: (foo|bar)/', $exception->getMessage());
|
||||
} else {
|
||||
$this->assertEquals(E_WARNING, $exception->getSeverity());
|
||||
$this->assertRegExp('/^Warning: Undefined variable \$(foo|bar)/', $exception->getMessage());
|
||||
$this->assertMatchesRegularExpression('/^Warning: Undefined variable \$(foo|bar)/', $exception->getMessage());
|
||||
}
|
||||
$this->assertEquals(__FILE__, $exception->getFile());
|
||||
|
||||
|
@ -821,7 +821,7 @@ class FilesystemTest extends FilesystemTestCase
|
||||
|
||||
$this->assertFalse(is_link($link));
|
||||
$this->assertFalse(is_file($link));
|
||||
$this->assertDirectoryNotExists($link);
|
||||
$this->assertDirectoryDoesNotExist($link);
|
||||
}
|
||||
|
||||
public function testSymlinkIsOverwrittenIfPointsToDifferentTarget()
|
||||
|
@ -23,11 +23,11 @@ class GitignoreTest extends TestCase
|
||||
$regex = Gitignore::toRegex($patterns);
|
||||
|
||||
foreach ($matchingCases as $matchingCase) {
|
||||
$this->assertRegExp($regex, $matchingCase, sprintf('Failed asserting path [%s] matches gitignore patterns [%s] using regex [%s]', $matchingCase, $patterns, $regex));
|
||||
$this->assertMatchesRegularExpression($regex, $matchingCase, sprintf('Failed asserting path [%s] matches gitignore patterns [%s] using regex [%s]', $matchingCase, $patterns, $regex));
|
||||
}
|
||||
|
||||
foreach ($nonMatchingCases as $nonMatchingCase) {
|
||||
$this->assertNotRegExp($regex, $nonMatchingCase, sprintf('Failed asserting path [%s] not matching gitignore patterns [%s] using regex [%s]', $nonMatchingCase, $patterns, $regex));
|
||||
$this->assertDoesNotMatchRegularExpression($regex, $nonMatchingCase, sprintf('Failed asserting path [%s] not matching gitignore patterns [%s] using regex [%s]', $nonMatchingCase, $patterns, $regex));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,13 +47,15 @@ class LocaleAwareListenerTest extends TestCase
|
||||
public function testDefaultLocaleIsUsedOnExceptionsInOnKernelRequest()
|
||||
{
|
||||
$this->localeAwareService
|
||||
->expects($this->at(0))
|
||||
->expects($this->exactly(2))
|
||||
->method('setLocale')
|
||||
->will($this->throwException(new \InvalidArgumentException()));
|
||||
$this->localeAwareService
|
||||
->expects($this->at(1))
|
||||
->method('setLocale')
|
||||
->with($this->equalTo('en'));
|
||||
->withConsecutive(
|
||||
[$this->anything()],
|
||||
['en']
|
||||
)
|
||||
->willReturnOnConsecutiveCalls(
|
||||
$this->throwException(new \InvalidArgumentException())
|
||||
);
|
||||
|
||||
$event = new RequestEvent($this->createHttpKernel(), $this->createRequest('fr'), HttpKernelInterface::MASTER_REQUEST);
|
||||
$this->listener->onKernelRequest($event);
|
||||
@ -89,13 +91,15 @@ class LocaleAwareListenerTest extends TestCase
|
||||
public function testDefaultLocaleIsUsedOnExceptionsInOnKernelFinishRequest()
|
||||
{
|
||||
$this->localeAwareService
|
||||
->expects($this->at(0))
|
||||
->expects($this->exactly(2))
|
||||
->method('setLocale')
|
||||
->will($this->throwException(new \InvalidArgumentException()));
|
||||
$this->localeAwareService
|
||||
->expects($this->at(1))
|
||||
->method('setLocale')
|
||||
->with($this->equalTo('en'));
|
||||
->withConsecutive(
|
||||
[$this->anything()],
|
||||
['en']
|
||||
)
|
||||
->willReturnOnConsecutiveCalls(
|
||||
$this->throwException(new \InvalidArgumentException())
|
||||
);
|
||||
|
||||
$this->requestStack->push($this->createRequest('fr'));
|
||||
$this->requestStack->push($subRequest = $this->createRequest('de'));
|
||||
|
@ -662,7 +662,7 @@ EOF;
|
||||
}
|
||||
};
|
||||
|
||||
$this->assertRegExp('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*TestDebugContainer$/', $kernel->getContainerClass());
|
||||
$this->assertMatchesRegularExpression('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*TestDebugContainer$/', $kernel->getContainerClass());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,13 +85,16 @@ class FailoverTransportTest extends TestCase
|
||||
public function testSendOneDeadAndRecoveryWithinRetryPeriod()
|
||||
{
|
||||
$t1 = $this->createMock(TransportInterface::class);
|
||||
$t1->expects($this->at(0))->method('send')->will($this->throwException(new TransportException()));
|
||||
$t1->expects($this->at(1))->method('send');
|
||||
$t1->method('send')->willReturnOnConsecutiveCalls($this->throwException(new TransportException()));
|
||||
$t2 = $this->createMock(TransportInterface::class);
|
||||
$t2->expects($this->at(0))->method('send');
|
||||
$t2->expects($this->at(1))->method('send');
|
||||
$t2->expects($this->at(2))->method('send');
|
||||
$t2->expects($this->at(3))->method('send')->will($this->throwException(new TransportException()));
|
||||
$t2->expects($this->exactly(4))
|
||||
->method('send')
|
||||
->willReturnOnConsecutiveCalls(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
$this->throwException(new TransportException())
|
||||
);
|
||||
$t = new FailoverTransport([$t1, $t2], 6);
|
||||
$t->send(new RawMessage('')); // t1>fail - t2>sent
|
||||
$this->assertTransports($t, 0, [$t1]);
|
||||
@ -112,13 +115,16 @@ class FailoverTransportTest extends TestCase
|
||||
public function testSendAllDeadWithinRetryPeriod()
|
||||
{
|
||||
$t1 = $this->createMock(TransportInterface::class);
|
||||
$t1->expects($this->at(0))->method('send')->will($this->throwException(new TransportException()));
|
||||
$t1->method('send')->will($this->throwException(new TransportException()));
|
||||
$t1->expects($this->once())->method('send');
|
||||
$t2 = $this->createMock(TransportInterface::class);
|
||||
$t2->expects($this->at(0))->method('send');
|
||||
$t2->expects($this->at(1))->method('send');
|
||||
$t2->expects($this->at(2))->method('send')->will($this->throwException(new TransportException()));
|
||||
$t2->expects($this->exactly(3))->method('send');
|
||||
$t2->expects($this->exactly(3))
|
||||
->method('send')
|
||||
->willReturnOnConsecutiveCalls(
|
||||
null,
|
||||
null,
|
||||
$this->throwException(new TransportException())
|
||||
);
|
||||
$t = new FailoverTransport([$t1, $t2], 40);
|
||||
$t->send(new RawMessage(''));
|
||||
sleep(4);
|
||||
@ -132,12 +138,14 @@ class FailoverTransportTest extends TestCase
|
||||
public function testSendOneDeadButRecover()
|
||||
{
|
||||
$t1 = $this->createMock(TransportInterface::class);
|
||||
$t1->expects($this->at(0))->method('send')->will($this->throwException(new TransportException()));
|
||||
$t1->expects($this->at(1))->method('send');
|
||||
$t1->method('send')->willReturnOnConsecutiveCalls($this->throwException(new TransportException()));
|
||||
$t2 = $this->createMock(TransportInterface::class);
|
||||
$t2->expects($this->at(0))->method('send');
|
||||
$t2->expects($this->at(1))->method('send');
|
||||
$t2->expects($this->at(2))->method('send')->will($this->throwException(new TransportException()));
|
||||
$t2->expects($this->exactly(3))
|
||||
->method('send')->willReturnOnConsecutiveCalls(
|
||||
null,
|
||||
null,
|
||||
$this->throwException(new TransportException())
|
||||
);
|
||||
$t = new FailoverTransport([$t1, $t2], 1);
|
||||
$t->send(new RawMessage(''));
|
||||
sleep(1);
|
||||
|
@ -103,8 +103,9 @@ class RoundRobinTransportTest extends TestCase
|
||||
$t1 = $this->createMock(TransportInterface::class);
|
||||
$t1->expects($this->exactly(3))->method('send');
|
||||
$t2 = $this->createMock(TransportInterface::class);
|
||||
$t2->expects($this->at(0))->method('send')->will($this->throwException(new TransportException()));
|
||||
$t2->expects($this->at(1))->method('send');
|
||||
$t2->expects($this->exactly(2))
|
||||
->method('send')
|
||||
->willReturnOnConsecutiveCalls($this->throwException(new TransportException()));
|
||||
$t = new RoundRobinTransport([$t1, $t2], 3);
|
||||
$t->send(new RawMessage(''));
|
||||
$this->assertTransports($t, 1, []);
|
||||
|
@ -11,7 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Messenger\Tests\Middleware;
|
||||
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\Constraint\Callback;
|
||||
use PHPUnit\Framework\MockObject\Stub\ReturnCallback;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Messenger\Envelope;
|
||||
use Symfony\Component\Messenger\Exception\DelayedMessageHandlingException;
|
||||
@ -51,13 +52,23 @@ class DispatchAfterCurrentBusMiddlewareTest extends TestCase
|
||||
$handlingMiddleware,
|
||||
]);
|
||||
|
||||
// Third event is dispatch within main dispatch, but before its handling:
|
||||
$this->expectHandledMessage($handlingMiddleware, 0, $thirdEvent);
|
||||
// Then expect main dispatched message to be handled first:
|
||||
$this->expectHandledMessage($handlingMiddleware, 1, $message);
|
||||
// Then, expect events in new transaction to be handled next, in dispatched order:
|
||||
$this->expectHandledMessage($handlingMiddleware, 2, $firstEvent);
|
||||
$this->expectHandledMessage($handlingMiddleware, 3, $secondEvent);
|
||||
$handlingMiddleware->expects($this->exactly(4))
|
||||
->method('handle')
|
||||
->withConsecutive(
|
||||
// Third event is dispatch within main dispatch, but before its handling:
|
||||
[$this->expectHandledMessage($thirdEvent)],
|
||||
// Then expect main dispatched message to be handled first:
|
||||
[$this->expectHandledMessage($message)],
|
||||
// Then, expect events in new transaction to be handled next, in dispatched order:
|
||||
[$this->expectHandledMessage($firstEvent)],
|
||||
[$this->expectHandledMessage($secondEvent)]
|
||||
)
|
||||
->willReturnOnConsecutiveCalls(
|
||||
$this->willHandleMessage(),
|
||||
$this->willHandleMessage(),
|
||||
$this->willHandleMessage(),
|
||||
$this->willHandleMessage()
|
||||
);
|
||||
|
||||
$messageBus->dispatch($message);
|
||||
}
|
||||
@ -86,12 +97,21 @@ class DispatchAfterCurrentBusMiddlewareTest extends TestCase
|
||||
$handlingMiddleware,
|
||||
]);
|
||||
|
||||
// Expect main dispatched message to be handled first:
|
||||
$this->expectHandledMessage($handlingMiddleware, 0, $message);
|
||||
// Then, expect events in new transaction to be handled next, in dispatched order:
|
||||
$this->expectThrowingHandling($handlingMiddleware, 1, $firstEvent, new \RuntimeException('Some exception while handling first event'));
|
||||
// Next event is still handled despite the previous exception:
|
||||
$this->expectHandledMessage($handlingMiddleware, 2, $secondEvent);
|
||||
$handlingMiddleware->expects($this->exactly(3))
|
||||
->method('handle')
|
||||
->withConsecutive(
|
||||
// Expect main dispatched message to be handled first:
|
||||
[$this->expectHandledMessage($message)],
|
||||
// Then, expect events in new transaction to be handled next, in dispatched order:
|
||||
[$this->expectHandledMessage($firstEvent)],
|
||||
// Next event is still handled despite the previous exception:
|
||||
[$this->expectHandledMessage($secondEvent)]
|
||||
)
|
||||
->willReturnOnConsecutiveCalls(
|
||||
$this->willHandleMessage(),
|
||||
$this->throwException(new \RuntimeException('Some exception while handling first event')),
|
||||
$this->willHandleMessage()
|
||||
);
|
||||
|
||||
$this->expectException(DelayedMessageHandlingException::class);
|
||||
$this->expectExceptionMessage('RuntimeException: Some exception while handling first event');
|
||||
@ -132,46 +152,46 @@ class DispatchAfterCurrentBusMiddlewareTest extends TestCase
|
||||
$handlingMiddleware,
|
||||
]);
|
||||
|
||||
// Expect main dispatched message to be handled first:
|
||||
$this->expectHandledMessage($handlingMiddleware, 0, $command);
|
||||
|
||||
$this->expectHandledMessage($handlingMiddleware, 1, $eventL1a);
|
||||
|
||||
// Handling $eventL1b will dispatch 2 more events
|
||||
$handlingMiddleware->expects($this->at(2))->method('handle')->with($this->callback(function (Envelope $envelope) use ($eventL1b) {
|
||||
return $envelope->getMessage() === $eventL1b;
|
||||
}))->willReturnCallback(function ($envelope, StackInterface $stack) use ($eventBus, $eventL2a, $eventL2b) {
|
||||
$envelope1 = new Envelope($eventL2a, [new DispatchAfterCurrentBusStamp()]);
|
||||
$eventBus->dispatch($envelope1);
|
||||
$eventBus->dispatch(new Envelope($eventL2b, [new DispatchAfterCurrentBusStamp()]));
|
||||
$handlingMiddleware->expects($this->exactly(7))
|
||||
->method('handle')
|
||||
->withConsecutive(
|
||||
// Expect main dispatched message to be handled first:
|
||||
[$this->expectHandledMessage($command)],
|
||||
[$this->expectHandledMessage($eventL1a)],
|
||||
[$this->expectHandledMessage($eventL1b)],
|
||||
[$this->expectHandledMessage($eventL1c)],
|
||||
// Handle $eventL2a will dispatch event and throw exception
|
||||
[$this->expectHandledMessage($eventL2a)],
|
||||
// Make sure $eventL2b is handled, since it was dispatched from $eventL1b
|
||||
[$this->expectHandledMessage($eventL2b)],
|
||||
// We dont handle exception L3a since L2a threw an exception.
|
||||
[$this->expectHandledMessage($eventL3b)]
|
||||
// Note: $eventL3a should not be handled.
|
||||
)
|
||||
->willReturnOnConsecutiveCalls(
|
||||
$this->willHandleMessage(),
|
||||
$this->willHandleMessage(),
|
||||
$this->returnCallback(function ($envelope, StackInterface $stack) use ($eventBus, $eventL2a, $eventL2b) {
|
||||
$envelope1 = new Envelope($eventL2a, [new DispatchAfterCurrentBusStamp()]);
|
||||
$eventBus->dispatch($envelope1);
|
||||
$eventBus->dispatch(new Envelope($eventL2b, [new DispatchAfterCurrentBusStamp()]));
|
||||
|
||||
return $stack->next()->handle($envelope, $stack);
|
||||
});
|
||||
return $stack->next()->handle($envelope, $stack);
|
||||
}),
|
||||
$this->willHandleMessage(),
|
||||
$this->returnCallback(function () use ($eventBus, $eventL3a) {
|
||||
$eventBus->dispatch(new Envelope($eventL3a, [new DispatchAfterCurrentBusStamp()]));
|
||||
|
||||
$this->expectHandledMessage($handlingMiddleware, 3, $eventL1c);
|
||||
throw new \RuntimeException('Some exception while handling Event level 2a');
|
||||
}),
|
||||
$this->returnCallback(function ($envelope, StackInterface $stack) use ($eventBus, $eventL3b) {
|
||||
$eventBus->dispatch(new Envelope($eventL3b, [new DispatchAfterCurrentBusStamp()]));
|
||||
|
||||
// Handle $eventL2a will dispatch event and throw exception
|
||||
$handlingMiddleware->expects($this->at(4))->method('handle')->with($this->callback(function (Envelope $envelope) use ($eventL2a) {
|
||||
return $envelope->getMessage() === $eventL2a;
|
||||
}))->willReturnCallback(function ($envelope, StackInterface $stack) use ($eventBus, $eventL3a) {
|
||||
$eventBus->dispatch(new Envelope($eventL3a, [new DispatchAfterCurrentBusStamp()]));
|
||||
|
||||
throw new \RuntimeException('Some exception while handling Event level 2a');
|
||||
});
|
||||
|
||||
// Make sure $eventL2b is handled, since it was dispatched from $eventL1b
|
||||
$handlingMiddleware->expects($this->at(5))->method('handle')->with($this->callback(function (Envelope $envelope) use ($eventL2b) {
|
||||
return $envelope->getMessage() === $eventL2b;
|
||||
}))->willReturnCallback(function ($envelope, StackInterface $stack) use ($eventBus, $eventL3b) {
|
||||
$eventBus->dispatch(new Envelope($eventL3b, [new DispatchAfterCurrentBusStamp()]));
|
||||
|
||||
return $stack->next()->handle($envelope, $stack);
|
||||
});
|
||||
|
||||
// We dont handle exception L3a since L2a threw an exception.
|
||||
$this->expectHandledMessage($handlingMiddleware, 6, $eventL3b);
|
||||
|
||||
// Note: $eventL3a should not be handled.
|
||||
return $stack->next()->handle($envelope, $stack);
|
||||
}),
|
||||
$this->willHandleMessage()
|
||||
);
|
||||
|
||||
$this->expectException(DelayedMessageHandlingException::class);
|
||||
$this->expectExceptionMessage('RuntimeException: Some exception while handling Event level 2a');
|
||||
@ -221,32 +241,32 @@ class DispatchAfterCurrentBusMiddlewareTest extends TestCase
|
||||
$commandHandlingMiddleware,
|
||||
]);
|
||||
|
||||
$this->expectHandledMessage($commandHandlingMiddleware, 0, $message);
|
||||
$this->expectHandledMessage($eventHandlingMiddleware, 0, $event);
|
||||
$commandHandlingMiddleware->expects($this->once())
|
||||
->method('handle')
|
||||
->with($this->expectHandledMessage($message))
|
||||
->willReturnCallback(function ($envelope, StackInterface $stack) {
|
||||
return $stack->next()->handle($envelope, $stack);
|
||||
});
|
||||
$eventHandlingMiddleware->expects($this->once())
|
||||
->method('handle')
|
||||
->with($this->expectHandledMessage($event))
|
||||
->willReturnCallback(function ($envelope, StackInterface $stack) {
|
||||
return $stack->next()->handle($envelope, $stack);
|
||||
});
|
||||
$messageBus->dispatch($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MiddlewareInterface|MockObject $handlingMiddleware
|
||||
*/
|
||||
private function expectHandledMessage(MiddlewareInterface $handlingMiddleware, int $at, $message): void
|
||||
private function expectHandledMessage($message): Callback
|
||||
{
|
||||
$handlingMiddleware->expects($this->at($at))->method('handle')->with($this->callback(function (Envelope $envelope) use ($message) {
|
||||
return $this->callback(function (Envelope $envelope) use ($message) {
|
||||
return $envelope->getMessage() === $message;
|
||||
}))->willReturnCallback(function ($envelope, StackInterface $stack) {
|
||||
return $stack->next()->handle($envelope, $stack);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MiddlewareInterface|MockObject $handlingMiddleware
|
||||
*/
|
||||
private function expectThrowingHandling(MiddlewareInterface $handlingMiddleware, int $at, $message, \Throwable $throwable): void
|
||||
private function willHandleMessage(): ReturnCallback
|
||||
{
|
||||
$handlingMiddleware->expects($this->at($at))->method('handle')->with($this->callback(function (Envelope $envelope) use ($message) {
|
||||
return $envelope->getMessage() === $message;
|
||||
}))->willReturnCallback(function () use ($throwable) {
|
||||
throw $throwable;
|
||||
return $this->returnCallback(function ($envelope, StackInterface $stack) {
|
||||
return $stack->next()->handle($envelope, $stack);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -87,13 +87,14 @@ class SerializerTest extends TestCase
|
||||
->with($validationStamp = new ValidationStamp(['foo', 'bar']));
|
||||
|
||||
$symfonySerializer
|
||||
->expects($this->at(2))
|
||||
->method('serialize')->with(
|
||||
$message,
|
||||
'json',
|
||||
[
|
||||
->expects($this->exactly(3))
|
||||
->method('serialize')
|
||||
->withConsecutive(
|
||||
[$this->anything()],
|
||||
[$this->anything()],
|
||||
[$message, 'json', [
|
||||
ObjectNormalizer::GROUPS => ['foo'],
|
||||
]
|
||||
]]
|
||||
)
|
||||
;
|
||||
|
||||
@ -113,23 +114,18 @@ class SerializerTest extends TestCase
|
||||
);
|
||||
|
||||
$symfonySerializer
|
||||
->expects($this->at(0))
|
||||
->expects($this->exactly(2))
|
||||
->method('deserialize')
|
||||
->with('[{"context":{"groups":["foo"]}}]', SerializerStamp::class.'[]', 'json', [])
|
||||
->willReturn([new SerializerStamp(['groups' => ['foo']])])
|
||||
;
|
||||
|
||||
$symfonySerializer
|
||||
->expects($this->at(1))
|
||||
->method('deserialize')->with(
|
||||
'{}',
|
||||
DummyMessage::class,
|
||||
'json',
|
||||
[
|
||||
->withConsecutive(
|
||||
['[{"context":{"groups":["foo"]}}]', SerializerStamp::class.'[]', 'json', []],
|
||||
['{}', DummyMessage::class, 'json', [
|
||||
ObjectNormalizer::GROUPS => ['foo'],
|
||||
]
|
||||
]]
|
||||
)
|
||||
->willReturnOnConsecutiveCalls(
|
||||
[new SerializerStamp(['groups' => ['foo']])],
|
||||
new DummyMessage('test')
|
||||
)
|
||||
->willReturn(new DummyMessage('test'))
|
||||
;
|
||||
|
||||
$serializer->decode([
|
||||
|
@ -46,13 +46,16 @@ class WorkerTest extends TestCase
|
||||
|
||||
$bus = $this->getMockBuilder(MessageBusInterface::class)->getMock();
|
||||
|
||||
$bus->expects($this->at(0))->method('dispatch')->with(
|
||||
new Envelope($apiMessage, [new ReceivedStamp('transport'), new ConsumedByWorkerStamp()])
|
||||
)->willReturnArgument(0);
|
||||
|
||||
$bus->expects($this->at(1))->method('dispatch')->with(
|
||||
new Envelope($ipaMessage, [new ReceivedStamp('transport'), new ConsumedByWorkerStamp()])
|
||||
)->willReturnArgument(0);
|
||||
$bus->expects($this->exactly(2))
|
||||
->method('dispatch')
|
||||
->withConsecutive(
|
||||
[new Envelope($apiMessage, [new ReceivedStamp('transport'), new ConsumedByWorkerStamp()])],
|
||||
[new Envelope($ipaMessage, [new ReceivedStamp('transport'), new ConsumedByWorkerStamp()])]
|
||||
)
|
||||
->willReturnOnConsecutiveCalls(
|
||||
$this->returnArgument(0),
|
||||
$this->returnArgument(0)
|
||||
);
|
||||
|
||||
$dispatcher = new EventDispatcher();
|
||||
$dispatcher->addSubscriber(new StopWorkerOnMessageLimitListener(2));
|
||||
|
@ -65,17 +65,17 @@ class Base64EncoderTest extends TestCase
|
||||
$encoder = new Base64Encoder();
|
||||
for ($i = 0; $i < 30; ++$i) {
|
||||
$input = pack('C', random_int(0, 255));
|
||||
$this->assertRegExp('~^[a-zA-Z0-9/\+]{2}==$~', $encoder->encodeString($input), 'A single byte should have 2 bytes of padding');
|
||||
$this->assertMatchesRegularExpression('~^[a-zA-Z0-9/\+]{2}==$~', $encoder->encodeString($input), 'A single byte should have 2 bytes of padding');
|
||||
}
|
||||
|
||||
for ($i = 0; $i < 30; ++$i) {
|
||||
$input = pack('C*', random_int(0, 255), random_int(0, 255));
|
||||
$this->assertRegExp('~^[a-zA-Z0-9/\+]{3}=$~', $encoder->encodeString($input), 'Two bytes should have 1 byte of padding');
|
||||
$this->assertMatchesRegularExpression('~^[a-zA-Z0-9/\+]{3}=$~', $encoder->encodeString($input), 'Two bytes should have 1 byte of padding');
|
||||
}
|
||||
|
||||
for ($i = 0; $i < 30; ++$i) {
|
||||
$input = pack('C*', random_int(0, 255), random_int(0, 255), random_int(0, 255));
|
||||
$this->assertRegExp('~^[a-zA-Z0-9/\+]{4}$~', $encoder->encodeString($input), 'Three bytes should have no padding');
|
||||
$this->assertMatchesRegularExpression('~^[a-zA-Z0-9/\+]{4}$~', $encoder->encodeString($input), 'Three bytes should have no padding');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ class QpMimeHeaderEncoderTest extends TestCase
|
||||
*/
|
||||
|
||||
$encoder = new QpMimeHeaderEncoder();
|
||||
$this->assertNotRegExp('~[ \t]~', $encoder->encodeString("a \t b"), 'encoded-words in headers cannot contain LWSP as per RFC 2047.');
|
||||
$this->assertDoesNotMatchRegularExpression('~[ \t]~', $encoder->encodeString("a \t b"), 'encoded-words in headers cannot contain LWSP as per RFC 2047.');
|
||||
}
|
||||
|
||||
public function testSpaceIsRepresentedByUnderscore()
|
||||
|
@ -38,7 +38,7 @@ class Rfc2231EncoderTest extends TestCase
|
||||
$encoded = $encoder->encodeString($string);
|
||||
|
||||
foreach (explode("\r\n", $encoded) as $line) {
|
||||
$this->assertRegExp($this->rfc2045Token, $line, 'Encoder should always return a valid RFC 2045 token.');
|
||||
$this->assertMatchesRegularExpression($this->rfc2045Token, $line, 'Encoder should always return a valid RFC 2045 token.');
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ class Rfc2231EncoderTest extends TestCase
|
||||
$encoded = $encoder->encodeString($string);
|
||||
|
||||
foreach (explode("\r\n", $encoded) as $line) {
|
||||
$this->assertRegExp($this->rfc2045Token, $line, 'Encoder should always return a valid RFC 2045 token.');
|
||||
$this->assertMatchesRegularExpression($this->rfc2045Token, $line, 'Encoder should always return a valid RFC 2045 token.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ class UnstructuredHeaderTest extends TestCase
|
||||
|
||||
$nonAsciiChar = pack('C', 0x8F);
|
||||
$header = new UnstructuredHeader('X-Test', $nonAsciiChar);
|
||||
$this->assertRegExp('~^[^:\x00-\x20\x80-\xFF]+: [^\x80-\xFF\r\n]+$~s', $header->toString());
|
||||
$this->assertMatchesRegularExpression('~^[^:\x00-\x20\x80-\xFF]+: [^\x80-\xFF\r\n]+$~s', $header->toString());
|
||||
}
|
||||
|
||||
public function testEncodedWordsFollowGeneralStructure()
|
||||
@ -91,7 +91,7 @@ class UnstructuredHeaderTest extends TestCase
|
||||
|
||||
$nonAsciiChar = pack('C', 0x8F);
|
||||
$header = new UnstructuredHeader('X-Test', $nonAsciiChar);
|
||||
$this->assertRegExp('~^X-Test: \=?.*?\?.*?\?.*?\?=$~s', $header->toString());
|
||||
$this->assertMatchesRegularExpression('~^X-Test: \=?.*?\?.*?\?.*?\?=$~s', $header->toString());
|
||||
}
|
||||
|
||||
public function testEncodedWordIncludesCharsetAndEncodingMethodAndText()
|
||||
|
@ -98,7 +98,7 @@ class FormDataPartTest extends TestCase
|
||||
'file' => new DataPart('data.csv', 'data.csv', 'text/csv'),
|
||||
]);
|
||||
$headers = $f->getPreparedHeaders()->toArray();
|
||||
$this->assertRegExp(
|
||||
$this->assertMatchesRegularExpression(
|
||||
'/^Content-Type: multipart\/form-data; boundary=[a-zA-Z0-9\-_]{8}$/',
|
||||
$headers[0]
|
||||
);
|
||||
|
@ -303,7 +303,7 @@ class DaoAuthenticationProviderTest extends TestCase
|
||||
|
||||
protected function getProvider($user = null, $userChecker = null, $passwordEncoder = null)
|
||||
{
|
||||
$userProvider = $this->getMockBuilder([UserProviderInterface::class, PasswordUpgraderInterface::class])->getMock();
|
||||
$userProvider = $this->getMockBuilder(PasswordUpgraderProvider::class)->getMock();
|
||||
if (null !== $user) {
|
||||
$userProvider->expects($this->once())
|
||||
->method('loadUserByUsername')
|
||||
@ -329,3 +329,7 @@ class DaoAuthenticationProviderTest extends TestCase
|
||||
return new DaoAuthenticationProvider($userProvider, $userChecker, 'key', $encoderFactory);
|
||||
}
|
||||
}
|
||||
|
||||
interface PasswordUpgraderProvider extends UserProviderInterface, PasswordUpgraderInterface
|
||||
{
|
||||
}
|
||||
|
@ -112,9 +112,10 @@ class LdapBindAuthenticationProviderTest extends TestCase
|
||||
|
||||
$ldap = $this->getMockBuilder(LdapInterface::class)->getMock();
|
||||
$ldap
|
||||
->expects($this->at(0))
|
||||
->method('bind')
|
||||
->with('elsa', 'test1234A$');
|
||||
->withConsecutive(
|
||||
['elsa', 'test1234A$']
|
||||
);
|
||||
$ldap
|
||||
->expects($this->once())
|
||||
->method('escape')
|
||||
@ -152,9 +153,10 @@ class LdapBindAuthenticationProviderTest extends TestCase
|
||||
|
||||
$ldap = $this->getMockBuilder(LdapInterface::class)->getMock();
|
||||
$ldap
|
||||
->expects($this->at(0))
|
||||
->method('bind')
|
||||
->with('elsa', 'test1234A$');
|
||||
->withConsecutive(
|
||||
['elsa', 'test1234A$']
|
||||
);
|
||||
$ldap
|
||||
->expects($this->once())
|
||||
->method('escape')
|
||||
@ -195,9 +197,10 @@ class LdapBindAuthenticationProviderTest extends TestCase
|
||||
|
||||
$ldap = $this->getMockBuilder(LdapInterface::class)->getMock();
|
||||
$ldap
|
||||
->expects($this->at(0))
|
||||
->method('bind')
|
||||
->with('elsa', 'test1234A$');
|
||||
->withConsecutive(
|
||||
['elsa', 'test1234A$']
|
||||
);
|
||||
$ldap
|
||||
->expects($this->once())
|
||||
->method('query')
|
||||
|
@ -353,7 +353,7 @@ class SerializerTest extends TestCase
|
||||
|
||||
public function testNormalizerAware()
|
||||
{
|
||||
$normalizerAware = $this->getMockBuilder([NormalizerAwareInterface::class, NormalizerInterface::class])->getMock();
|
||||
$normalizerAware = $this->getMockBuilder(NormalizerAwareNormalizer::class)->getMock();
|
||||
$normalizerAware->expects($this->once())
|
||||
->method('setNormalizer')
|
||||
->with($this->isInstanceOf(NormalizerInterface::class));
|
||||
@ -363,7 +363,7 @@ class SerializerTest extends TestCase
|
||||
|
||||
public function testDenormalizerAware()
|
||||
{
|
||||
$denormalizerAware = $this->getMockBuilder([DenormalizerAwareInterface::class, DenormalizerInterface::class])->getMock();
|
||||
$denormalizerAware = $this->getMockBuilder(DenormalizerAwareDenormalizer::class)->getMock();
|
||||
$denormalizerAware->expects($this->once())
|
||||
->method('setDenormalizer')
|
||||
->with($this->isInstanceOf(DenormalizerInterface::class));
|
||||
@ -603,3 +603,11 @@ class Bar
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
interface NormalizerAwareNormalizer extends NormalizerInterface, NormalizerAwareInterface
|
||||
{
|
||||
}
|
||||
|
||||
interface DenormalizerAwareDenormalizer extends DenormalizerInterface, DenormalizerAwareInterface
|
||||
{
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class FileDumperTest extends TestCase
|
||||
$this->assertStringEqualsFile($tempDir.'/d1+intl-icu.en.concrete', 'bar=foo');
|
||||
@unlink($tempDir.'/d1+intl-icu.en.concrete');
|
||||
|
||||
$this->assertFileNotExists($tempDir.'/d2.en.concrete');
|
||||
$this->assertFileDoesNotExist($tempDir.'/d2.en.concrete');
|
||||
$this->assertStringEqualsFile($tempDir.'/d2+intl-icu.en.concrete', 'bar=foo');
|
||||
@unlink($tempDir.'/d2+intl-icu.en.concrete');
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class LintCommandTest extends TestCase
|
||||
$ret = $tester->execute(['filename' => [$filename1, $filename2]], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]);
|
||||
|
||||
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
|
||||
$this->assertRegExp('/^\/\/ OK in /', trim($tester->getDisplay()));
|
||||
$this->assertMatchesRegularExpression('/^\/\/ OK in /', trim($tester->getDisplay()));
|
||||
}
|
||||
|
||||
public function testLintIncorrectFile()
|
||||
|
@ -844,7 +844,7 @@ abstract class HttpClientTestCase extends TestCase
|
||||
|
||||
$body = $response->toArray();
|
||||
$this->assertSame('localhost:8057', $body['HTTP_HOST']);
|
||||
$this->assertRegexp('#^http://(localhost|127\.0\.0\.1):8057/$#', $body['REQUEST_URI']);
|
||||
$this->assertMatchesRegularExpression('#^http://(localhost|127\.0\.0\.1):8057/$#', $body['REQUEST_URI']);
|
||||
|
||||
$response = $client->request('GET', 'http://localhost:8057/', [
|
||||
'proxy' => 'http://foo:b%3Dar@localhost:8057',
|
||||
|
Reference in New Issue
Block a user