8000 Fix ftests · symfony/symfony@3ac7750 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3ac7750

Browse files
committed
Fix ftests
1 parent db63b22 commit 3ac7750

File tree

1 file changed

+21
-18
lines changed
  • src/Symfony/Component/Notifier/Tests/Transport

1 file changed

+21
-18
lines changed

src/Symfony/Component/Notifier/Tests/Transport/DsnTest.php

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -208,28 +208,37 @@ public function getOptionProvider(): iterable
208208
];
209209
}
210210

211-
public function testGetRequiredOptionGetsOptionIfSet()
211+
/**
212+
* @dataProvider getRequiredOptionProvider
213+
*/
214+
public function testGetRequiredOption(string $expectedValue, string $options, string $option)
212215
{
213-
$options = ['with_value' => 'some value'];
214-
$dsn = new Dsn('scheme', 'localhost', 'u$er', 'pa$s', '8000', $options, '/channel');
216+
$dsn = Dsn::fromString(sprintf('scheme://localhost?%s', $options));
215217

216-
$this->assertSame('some value', $dsn->getRequiredOption('with_value'));
218+
$this->assertSame($expectedValue, $dsn->getRequiredOption($option));
217219
}
218220

219-
public function testGetRequiredOptionGetsOptionIfValueIsZero()
221+
public function getRequiredOptionProvider(): iterable
220222
{
221-
$options = ['timeout' => 0];
222-
$dsn = new Dsn('scheme', 'localhost', 'u$er', 'pa$s', '8000', $options, '/channel');
223+
yield [
224+
'value',
225+
'with_value=value',
226+
'with_value'
227+
];
223228

224-
$this->assertSame(0, $dsn->getRequiredOption('timeout'));
229+
yield [
230+
'0',
231+
'timeout=0',
232+
'timeout'
233+
];
225234
}
226235

227236
/**
228237
* @dataProvider getRequiredOptionThrowsMissingRequiredOptionExceptionProvider
229238
*/
230-
public function testGetRequiredOptionThrowsMissingRequiredOptionException(string $expectedExceptionMessage, array $options, string $option)
239+
public function testGetRequiredOptionThrowsMissingRequiredOptionException(string $expectedExceptionMessage, string $options, string $option)
231240
{
232-
$dsn = new Dsn('scheme', 'localhost', 'u$er', 'pa$s', '8000', $options, '/channel');
241+
$dsn = Dsn::fromString(sprintf('scheme://localhost?%s', $options));
233242

234243
$this->expectException(MissingRequiredOptionException::class);
235244
$this->expectExceptionMessage($expectedExceptionMessage);
@@ -241,20 +250,14 @@ public function getRequiredOptionThrowsMissingRequiredOptionExceptionProvider():
241250
{
242251
yield [
243252
'The option "foo_bar" is required but missing.',
244-
['with_value' => 'some value'],
253+
'with_value=value',
245254
'foo_bar',
246255
];
247256

248257
yield [
249258
'The option "with_empty_string" is required but missing.',
250-
['with_empty_string' => ''],
259+
'with_empty_string=',
251260
'with_empty_string',
252261
];
253-
254-
yield [
255-
'The option "with_null" is required but missing.',
256-
['with_null' => null],
257-
'with_null',
258-
];
259262
}
260263
}

0 commit comments

Comments
 (0)
0