8000 minor #22066 fix some risky tests (xabbuh) · MacDada/symfony@65260bc · GitHub
[go: up one dir, main page]

Skip to content

Commit 65260bc

Browse files
committed
minor symfony#22066 fix some risky tests (xabbuh)
This PR was merged into the 2.7 branch. Discussion ---------- fix some risky tests | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | PHPUnit 6 marks tests as risky when they have no assertions (and are not marked as skipped or incomplete). This PR will update our test suite accordingly. Component that still need to be covered: - [ ] Config - [ ] Form - [ ] HttpFoundation - [ ] Security - [ ] Workflow Commits ------- abf1787 fix some risky tests
2 parents 8ba279b + abf1787 commit 65260bc

36 files changed

+206
-128
lines changed

src/Symfony/Bridge/Doctrine/Tests/HttpFoundation/DbalSessionHandlerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@ public function testConstruct()
2525
{
2626
$connection = $this->getMockBuilder('Doctrine\DBAL\Connection')->disableOriginalConstructor()->getMock();
2727
$handler = new DbalSessionHandler($connection);
28+
29+
$this->assertInstanceOf('Symfony\Bridge\Doctrine\HttpFoundation\DbalSessionHandler', $handler);
2830
}
2931
}

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,36 +118,36 @@ protected function setTheme(FormView $view, array $themes)
118118

119119
public function testRange()
120120
{
121-
// No-op for forward compatibility with AbstractLayoutTest 2.8
121+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
122122
}
123123

124124
public function testRangeWithMinMaxValues()
125125
{
126-
// No-op for forward compatibility with AbstractLayoutTest 2.8
126+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
127127
}
128128

129129
public function testLabelWithoutTranslationOnButton()
130130
{
131-
// No-op for forward compatibility with AbstractLayoutTest 2.8
131+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
132132
}
133133

134134
public function testSingleChoiceWithPlaceholderWithoutTranslation()
135135
{
136-
// No-op for forward compatibility with AbstractLayoutTest 2.8
136+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
137137
}
138138

139139
public function testSingleChoiceExpandedWithPlaceholderWithoutTranslation()
140140
{
141-
// No-op for forward compatibility with AbstractLayoutTest 2.8
141+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
142142
}
143143

144144
public function testButtonlabelWithoutTranslation()
145145
{
146-
// No-op for forward compatibility with AbstractLayoutTest 2.8
146+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
147147
}
148148

149149
public function testAttributesNotTranslatedWhenTranslationDomainIsFalse()
150150
{
151-
// No-op for forward compatibility with AbstractLayoutTest 2.8
151+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
152152
}
153153
}

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,36 +118,36 @@ protected function setTheme(FormView $view, array $themes)
118118

119119
public function testRange()
120120
{
121-
// No-op for forward compatibility with AbstractLayoutTest 2.8
121+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
122122
}
123123

124124
public function testRangeWithMinMaxValues()
125125
{
126-
// No-op for forward compatibility with AbstractLayoutTest 2.8
126+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
127127
}
128128

129129
public function testLabelWithoutTranslationOnButton()
130130
{
131-
// No-op for forward compatibility with AbstractLayoutTest 2.8
131+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
132132
}
133133

134134
public function testSingleChoiceWithPlaceholderWithoutTranslation()
135135
{
136-
// No-op for forward compatibility with AbstractLayoutTest 2.8
136+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
137137
}
138138

139139
public function testSingleChoiceExpandedWithPlaceholderWithoutTranslation()
140140
{
141-
// No-op for forward compatibility with AbstractLayoutTest 2.8
141+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
142142
}
143143

144144
public function testButtonlabelWithoutTranslation()
145145
{
146-
// No-op for forward compatibility with AbstractLayoutTest 2.8
146+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
147147
}
148148

149149
public function testAttributesNotTranslatedWhenTranslationDomainIsFalse()
150150
{
151-
// No-op for forward compatibility with AbstractLayoutTest 2.8
151+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
152152
}
153153
}

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ public function testThemeBlockInheritanceUsingDynamicExtend()
105105

106106
$renderer = $this->extension->renderer;
107107
$renderer->setTheme($view, array('page_dynamic_extends.html.twig'));
108-
$renderer->searchAndRenderBlock($view, 'row');
108+
109+
$this->assertMatchesXpath(
110+
$renderer->searchAndRenderBlock($view, 'row'),
111+
'/div/label[text()="child"]'
112+
);
109113
}
110114

111115
public function isSelectedChoiceProvider()
@@ -211,36 +215,36 @@ public static function themeInheritanceProvider()
211215

212216
public function testRange()
213217
{
214-
// No-op for forward compatibility with AbstractLayoutTest 2.8
218+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
215219
}
216220

217221
public function testRangeWithMinMaxValues()
218222
{
219-
// No-op for forward compatibility with AbstractLayoutTest 2.8
223+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
220224
}
221225

222226
public function testLabelWithoutTranslationOnButton()
223227
{
224-
// No-op for forward compatibility with AbstractLayoutTest 2.8
228+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
225229
}
226230

227231
public function testSingleChoiceWithPlaceholderWithoutTranslation()
228232
{
229-
// No-op for forward compatibility with AbstractLayoutTest 2.8
233+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
230234
}
231235

232236
public function testSingleChoiceExpandedWithPlaceholderWithoutTranslation()
233237
{
234-
// No-op for forward compatibility with AbstractLayoutTest 2.8
238+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
235239
}
236240

237241
public function testButtonlabelWithoutTranslation()
238242
{
239-
// No-op for forward compatibility with AbstractLayoutTest 2.8
243+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
240244
}
241245

242246
public function testAttributesNotTranslatedWhenTranslationDomainIsFalse()
243247
{
244-
// No-op for forward compatibility with AbstractLayoutTest 2.8
248+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
245249
}
246250
}

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,36 +119,36 @@ protected function setTheme(FormView $view, array $themes)
119119

120120
public function testRange()
121121
{
122-
// No-op for forward compatibility with AbstractLayoutTest 2.8
122+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
123123
}
124124

125125
public function testRangeWithMinMaxValues()
126126
{
127-
// No-op for forward compatibility with AbstractLayoutTest 2.8
127+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
128128
}
129129

130130
public function testLabelWithoutTranslationOnButton()
131131
{
132-
// No-op for forward compatibility with AbstractLayoutTest 2.8
132+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
133133
}
134134

135135
public function testSingleChoiceWithPlaceholderWithoutTranslation()
136136
{
137-
// No-op for forward compatibility with AbstractLayoutTest 2.8
137+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
138138
}
139139

140140
public function testSingleChoiceExpandedWithPlaceholderWithoutTranslation()
141141
{
142-
// No-op for forward compatibility with AbstractLayoutTest 2.8
142+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
143143
}
144144

145145
public function testButtonlabelWithoutTranslation()
146146
{
147-
// No-op for forward compatibility with AbstractLayoutTest 2.8
147+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
148148
}
149149

150150
public function testAttributesNotTranslatedWhenTranslationDomainIsFalse()
151151
{
152-
// No-op for forward compatibility with AbstractLayoutTest 2.8
152+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
153153
}
154154
}

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,36 +131,36 @@ public static function themeInheritanceProvider()
131131

132132
public function testRange()
133133
{
134-
// No-op for forward compatibility with AbstractLayoutTest 2.8
134+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
135135
}
136136

137137
public function testRangeWithMinMaxValues()
138138
{
139-
// No-op for forward compatibility with AbstractLayoutTest 2.8
139+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
140140
}
141141

142142
public function testLabelWithoutTranslationOnButton()
143143
{
144-
// No-op for forward compatibility with AbstractLayoutTest 2.8
144+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
145145
}
146146

147147
public function testSingleChoiceWithPlaceholderWithoutTranslation()
148148
{
149-
// No-op for forward compatibility with AbstractLayoutTest 2.8
149+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
150150
}
151151

152152
public function testSingleChoiceExpandedWithPlaceholderWithoutTranslation()
153153
{
154-
// No-op for forward compatibility with AbstractLayoutTest 2.8
154+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
155155
}
156156

157157
public function testButtonlabelWithoutTranslation()
158158
{
159-
// No-op for forward compatibility with AbstractLayoutTest 2.8
159+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
160160
}
161161

162162
public function testAttributesNotTranslatedWhenTranslationDomainIsFalse()
163163
{
164-
// No-op for forward compatibility with AbstractLayoutTest 2.8
164+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
165165
}
166166
}

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,36 +118,36 @@ protected function setTheme(FormView $view, array $themes)
118118

119119
public function testRange()
120120
{
121-
// No-op for forward compatibility with AbstractLayoutTest 2.8
121+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
122122
}
123123

124124
public function testRangeWithMinMaxValues()
125125
{
126-
// No-op for forward compatibility with AbstractLayoutTest 2.8
126+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
127127
}
128128

129129
public function testLabelWithoutTranslationOnButton()
130130
{
131-
// No-op for forward compatibility with AbstractLayoutTest 2.8
131+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
132132
}
133133

134134
public function testSingleChoiceWithPlaceholderWithoutTranslation()
135135
{
136-
// No-op for forward compatibility with AbstractLayoutTest 2.8
136+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
137137
}
138138

139139
public function testSingleChoiceExpandedWithPlaceholderWithoutTranslation()
140140
{
141-
// No-op for forward compatibility with AbstractLayoutTest 2.8
141+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
142142
}
143143

144144
public function testButtonlabelWithoutTranslation()
145145
{
146-
// No-op for forward compatibility with AbstractLayoutTest 2.8
146+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
147147
}
148148

149149
public function testAttributesNotTranslatedWhenTranslationDomainIsFalse()
150150
{
151-
// No-op for forward compatibility with AbstractLayoutTest 2.8
151+
$this->markTestIncomplete('No-op for forward compatibility with AbstractLayoutTest 2.8');
152152
}
153153
}

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/StopwatchHelperTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@ public function testDevEnvironment()
3030
public function testProdEnvironment()
3131
{
3232
$helper = new StopwatchHelper(null);
33+
$helper->start('foo');
3334

34-
try {
35-
$helper->start('foo');
36-
} catch (\BadMethodCallException $e) {
37-
$this->fail('Assumed stopwatch is not called when not provided');
38-
}
35+
// add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
36+
// can be executed without throwing any exceptions
37+
$this->addToAssertionCount(1);
3938
}
4039
}

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateTest.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,9 @@ class TemplateTest extends TestCase
1919
/**
2020
* @dataProvider getTemplateToPathProvider
2121
*/
22-
public function testGetPathForTemplatesInABundle($template, $path)
22+
public function testGetPathForTemplate($template, $path)
2323
{
24-
if ($template->get('bundle')) {
25-
$this->assertEquals($template->getPath(), $path);
26-
}
27-
}
28-
29-
/**
30-
* @dataProvider getTemplateToPathProvider
31-
*/
32-
public function testGetPathForTemplatesOutOfABundle($template, $path)
33-
{
34-
if (!$template->get('bundle')) {
35-
$this->assertEquals($template->getPath(), $path);
36-
}
24+
$this->assertSame($template->getPath(), $path);
3725
}
3826

3927
public function getTemplateToPathProvider()

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,12 @@ public function testVerboseValueNotBreakArguments()
704704
$input = new ArgvInput(array('cli.php', '-v', 'foo:bar'));
705705
$application->run($input, $output);
706706

707+
$this->addToAssertionCount(1);
708+
707709
$input = new ArgvInput(array('cli.php', '--verbose', 'foo:bar'));
708710
$application->run($input, $output);
711+
712+
$this->addToAssertionCount(1);
709713
}
710714

711715
public function testRunReturnsIntegerExitCode()

src/Symfony/Component/Console/Tests/Helper/TableTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function tearDown()
3434
}
3535

3636
/**
37-
* @dataProvider testRenderProvider
37+
* @dataProvider renderProvider
3838
*/
3939
public function testRender($headers, $rows, $style, $expected, $decorated = false)
4040
{
@@ -50,7 +50,7 @@ public function testRender($headers, $rows, $style, $expected, $decorated = fals
5050
}
5151

5252
/**
53-
* @dataProvider testRenderProvider
53+
* @dataProvider renderProvider
5454
*/
5555
public function testRenderAddRows($headers, $rows, $style, $expected, $decorated = false)
5656
{
@@ -66,7 +66,7 @@ public function testRenderAddRows($headers, $rows, $style, $expected, $decorated
6666
}
6767

6868
/**
69-
* @dataProvider testRenderProvider
69+
* @dataProvider renderProvider
7070
*/
7171
public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected, $decorated = false)
7272
{
@@ -83,7 +83,7 @@ public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected, $d
8383
$this->assertEquals($expected, $this->getOutputContent($output));
8484
}
8585

86-
public function testRenderProvider()
86+
public function renderProvider()
8787
{
8888
$books = array(
8989
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ public function testProcessIgnoresMethodCalls()
114114
$container->register('b')->addMethodCall('setA', array(new Reference('a')));
115115

116116
$this->process($container);
117+
118+
$this->addToAssertionCount(1);
117119
}
118120

119121
protected function process(ContainerBuilder $container)

0 commit comments

Comments
 (0)
0