Skip to content

Commit 046e45e

Browse files
committed
Fix deprecation on 4.3
1 parent 3cd7726 commit 046e45e

File tree

16 files changed

+212
-130
lines changed

16 files changed

+212
-130
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ matrix:
3030
env: deps=high
3131
- php: 7.3
3232
env: deps=low
33+
- php: 7.4snapshot
34+
allow_failures:
35+
- php: 7.4snapshot
3336
fast_finish: true
3437

3538
cache:

src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function testGetMetadata()
120120
CacheItem::METADATA_EXPIRY => 9.5 + time(),
121121
CacheItem::METADATA_CTIME => 1000,
122122
];
123-
$this->assertEquals($expected, $item->getMetadata(), 'Item metadata should embed expiry and ctime.', .6);
123+
$this->assertEqualsWithDelta($expected, $item->getMetadata(), .6, 'Item metadata should embed expiry and ctime.');
124124
}
125125

126126
public function testDefaultLifeTime()

src/Symfony/Component/Config/Tests/Definition/Builder/NodeDefinitionTest.php

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,25 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
1616
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
17-
use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition;
1817

1918
class NodeDefinitionTest extends TestCase
2019
{
21-
public function testDefaultPathSeparatorIsDot()
22-
{
23-
$node = $this->getMockForAbstractClass(NodeDefinition::class, ['foo']);
24-
25-
$this->assertAttributeSame('.', 'pathSeparator', $node);
26-
}
27-
2820
public function testSetPathSeparatorChangesChildren()
2921
{
30-
$node = new ArrayNodeDefinition('foo');
31-
$scalar = new ScalarNodeDefinition('bar');
32-
$node->append($scalar);
33-
34-
$node->setPathSeparator('/');
35-
36-
$this->assertAttributeSame('/', 'pathSeparator', $node);
37-
$this->assertAttributeSame('/', 'pathSeparator', $scalar);
22+
$parentNode = new ArrayNodeDefinition('name');
23+
$childNode = $this->createMock(NodeDefinition::class);
24+
25+
$childNode
26+
->expects($this->once())
27+
->method('setPathSeparator')
28+
->with('/');
29+
$childNode
30+
->expects($this->once())
31+
->method('setParent')
32+
->with($parentNode)
33+
->willReturn($childNode);
34+
$parentNode->append($childNode);
35+
36+
$parentNode->setPathSeparator('/');
3837
}
3938
}

src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php

Lines changed: 135 additions & 80 deletions
Large diffs are not rendered by default.

src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ public function testRegisterClassesWithExclude()
142142

143143
public function testRegisterClassesWithExcludeAsArray()
144144
{
145+
if (\PHP_VERSION_ID >= 70400) {
146+
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
147+
}
148+
145149
$container = new ContainerBuilder();
146150
$container->setParameter('sub_dir', 'Sub');
147151
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));

src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ public function testChoiceTranslationLocaleOption()
5151
->createView()->vars['choices'];
5252

5353
// Don't check objects for identity
54-
$this->assertContains(new ChoiceView('DE', 'DE', 'Німеччина'), $choices, '', false, false);
55-
$this->assertContains(new ChoiceView('GB', 'GB', 'Велика Британія'), $choices, '', false, false);
56-
$this->assertContains(new ChoiceView('US', 'US', 'Сполучені Штати'), $choices, '', false, false);
57-
$this->assertContains(new ChoiceView('FR', 'FR', 'Франція'), $choices, '', false, false);
58-
$this->assertContains(new ChoiceView('MY', 'MY', 'Малайзія'), $choices, '', false, false);
54+
$this->assertContainsEquals(new ChoiceView('DE', 'DE', 'Німеччина'), $choices);
55+
$this->assertContainsEquals(new ChoiceView('GB', 'GB', 'Велика Британія'), $choices);
56+
$this->assertContainsEquals(new ChoiceView('US', 'US', 'Сполучені Штати'), $choices);
57+
$this->assertContainsEquals(new ChoiceView('FR', 'FR', 'Франція'), $choices);
58+
$this->assertContainsEquals(new ChoiceView('MY', 'MY', 'Малайзія'), $choices);
5959
}
6060

6161
public function testUnknownCountryIsNotIncluded()

src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public function testChoiceTranslationLocaleOption()
4848
->createView()->vars['choices'];
4949

5050
// Don't check objects for identity
51-
$this->assertContains(new ChoiceView('EUR', 'EUR', 'євро'), $choices, '', false, false);
52-
$this->assertContains(new ChoiceView('USD', 'USD', 'долар США'), $choices, '', false, false);
53-
$this->assertContains(new ChoiceView('SIT', 'SIT', 'словенський толар'), $choices, '', false, false);
51+
$this->assertContainsEquals(new ChoiceView('EUR', 'EUR', 'євро'), $choices);
52+
$this->assertContainsEquals(new ChoiceView('USD', 'USD', 'долар США'), $choices);
53+
$this->assertContainsEquals(new ChoiceView('SIT', 'SIT', 'словенський толар'), $choices);
5454
}
5555

5656
public function testSubmitNull($expected = null, $norm = null, $view = null)

src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ public function testChoiceTranslationLocaleOption()
5050
->createView()->vars['choices'];
5151

5252
// Don't check objects for identity
53-
$this->assertContains(new ChoiceView('en', 'en', 'англійська'), $choices, '', false, false);
54-
$this->assertContains(new ChoiceView('en_US', 'en_US', 'англійська (США)'), $choices, '', false, false);
55-
$this->assertContains(new ChoiceView('fr', 'fr', 'французька'), $choices, '', false, false);
56-
$this->assertContains(new ChoiceView('my', 'my', 'бірманська'), $choices, '', false, false);
53+
$this->assertContainsEquals(new ChoiceView('en', 'en', 'англійська'), $choices);
54+
$this->assertContainsEquals(new ChoiceView('en_US', 'en_US', 'англійська (США)'), $choices);
55+
$this->assertContainsEquals(new ChoiceView('fr', 'fr', 'французька'), $choices);
56+
$this->assertContainsEquals(new ChoiceView('my', 'my', 'бірманська'), $choices);
5757
}
5858

5959
public function testMultipleLanguagesIsNotIncluded()

src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public function testChoiceTranslationLocaleOption()
4848
->createView()->vars['choices'];
4949

5050
// Don't check objects for identity
51-
$this->assertContains(new ChoiceView('en', 'en', 'англійська'), $choices, '', false, false);
52-
$this->assertContains(new ChoiceView('en_GB', 'en_GB', 'англійська (Велика Британія)'), $choices, '', false, false);
53-
$this->assertContains(new ChoiceView('zh_Hant_MO', 'zh_Hant_MO', 'китайська (традиційна, Макао, О.А.Р Китаю)'), $choices, '', false, false);
51+
$this->assertContainsEquals(new ChoiceView('en', 'en', 'англійська'), $choices);
52+
$this->assertContainsEquals(new ChoiceView('en_GB', 'en_GB', 'англійська (Велика Британія)'), $choices);
53+
$this->assertContainsEquals(new ChoiceView('zh_Hant_MO', 'zh_Hant_MO', 'китайська (традиційна, Макао, О.А.Р Китаю)'), $choices);
5454
}
5555

5656
public function testSubmitNull($expected = null, $norm = null, $view = null)

src/Symfony/Component/Mailer/Tests/Transport/AbstractTransportTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ public function testThrottling()
3131

3232
$start = time();
3333
$transport->send($message, $envelope);
34-
$this->assertEquals(0, time() - $start, '', 1);
34+
$this->assertEqualsWithDelta(0, time() - $start, 1);
3535
$transport->send($message, $envelope);
36-
$this->assertEquals(5, time() - $start, '', 1);
36+
$this->assertEqualsWithDelta(5, time() - $start, 1);
3737
$transport->send($message, $envelope);
38-
$this->assertEquals(10, time() - $start, '', 1);
38+
$this->assertEqualsWithDelta(10, time() - $start, 1);
3939
$transport->send($message, $envelope);
40-
$this->assertEquals(15, time() - $start, '', 1);
40+
$this->assertEqualsWithDelta(15, time() - $start, 1);
4141

4242
$start = time();
4343
$transport->setMaxPerSecond(-3);
4444
$transport->send($message, $envelope);
45-
$this->assertEquals(0, time() - $start, '', 1);
45+
$this->assertEqualsWithDelta(0, time() - $start, 1);
4646
$transport->send($message, $envelope);
47-
$this->assertEquals(0, time() - $start, '', 1);
47+
$this->assertEqualsWithDelta(0, time() - $start, 1);
4848
}
4949
}

0 commit comments

Comments
 (0)