Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit98a946a

Browse files
committed
minor#17859 [2.7] [FrameworkBundle] minor fix tests added by#17569 (HeahDude)
This PR was merged into the 2.7 branch.Discussion----------[2.7] [FrameworkBundle] minor fix tests added by#17569| Q | A| ------------- | ---| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | n/a| License | MIT| Doc PR | -Commits-------ce6e5ac [2.7] [FrameworkBundle] minor fix tests added by#17569
2 parents653428a +ce6e5ac commit98a946a

File tree

1 file changed

+22
-40
lines changed

1 file changed

+22
-40
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php‎

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function testBundleInterfaceImplementation()
2424
{
2525
$bundle =$this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
2626

27-
$kernel =$this->getKernel(array($bundle));
27+
$kernel =$this->getKernel(array($bundle),true);
2828

2929
$application =newApplication($kernel);
3030
$application->doRun(newArrayInput(array('list')),newNullOutput());
@@ -35,7 +35,7 @@ public function testBundleCommandsAreRegistered()
3535
$bundle =$this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
3636
$bundle->expects($this->once())->method('registerCommands');
3737

38-
$kernel =$this->getKernel(array($bundle));
38+
$kernel =$this->getKernel(array($bundle),true);
3939

4040
$application =newApplication($kernel);
4141
$application->doRun(newArrayInput(array('list')),newNullOutput());
@@ -49,12 +49,7 @@ public function testBundleCommandsAreRetrievable()
4949
$bundle =$this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
5050
$bundle->expects($this->once())->method('registerCommands');
5151

52-
$kernel =$this->getMock('Symfony\Component\HttpKernel\KernelInterface');
53-
$kernel
54-
->expects($this->any())
55-
->method('getBundles')
56-
->will($this->returnValue(array($bundle)))
57-
;
52+
$kernel =$this->getKernel(array($bundle));
5853

5954
$application =newApplication($kernel);
6055
$application->all();
@@ -68,12 +63,7 @@ public function testBundleSingleCommandIsRetrievable()
6863
$bundle =$this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
6964
$bundle->expects($this->once())->method('registerCommands');
7065

71-
$kernel =$this->getMock('Symfony\Component\HttpKernel\KernelInterface');
72-
$kernel
73-
->expects($this->any())
74-
->method('getBundles')
75-
->will($this->returnValue(array($bundle)))
76-
;
66+
$kernel =$this->getKernel(array($bundle));
7767

7868
$application =newApplication($kernel);
7969

@@ -88,12 +78,7 @@ public function testBundleCommandCanBeFound()
8878
$bundle =$this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
8979
$bundle->expects($this->once())->method('registerCommands');
9080

91-
$kernel =$this->getMock('Symfony\Component\HttpKernel\KernelInterface');
92-
$kernel
93-
->expects($this->any())
94-
->method('getBundles')
95-
->will($this->returnValue(array($bundle)))
96-
;
81+
$kernel =$this->getKernel(array($bundle));
9782

9883
$application =newApplication($kernel);
9984

@@ -108,12 +93,7 @@ public function testBundleCommandCanBeFoundByAlias()
10893
$bundle =$this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
10994
$bundle->expects($this->once())->method('registerCommands');
11095

111-
$kernel =$this->getMock('Symfony\Component\HttpKernel\KernelInterface');
112-
$kernel
113-
->expects($this->any())
114-
->method('getBundles')
115-
->will($this->returnValue(array($bundle)))
116-
;
96+
$kernel =$this->getKernel(array($bundle));
11797

11898
$application =newApplication($kernel);
11999

@@ -130,7 +110,7 @@ public function testBundleCommandsHaveRightContainer()
130110
$command->setCode(function () {});
131111
$command->expects($this->exactly(2))->method('setContainer');
132112

133-
$application =newApplication($this->getKernel(array()));
113+
$application =newApplication($this->getKernel(array(),true));
134114
$application->setAutoExit(false);
135115
$application->setCatchExceptions(false);
136116
$application->add($command);
@@ -143,21 +123,23 @@ public function testBundleCommandsHaveRightContainer()
143123
$tester->run(array('command' =>'foo'));
144124
}
145125

146-
privatefunctiongetKernel(array$bundles)
126+
privatefunctiongetKernel(array$bundles,$useDispatcher =false)
147127
{
148-
$dispatcher =$this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
149-
$dispatcher
150-
->expects($this->atLeastOnce())
151-
->method('dispatch')
152-
;
153-
154128
$container =$this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
155-
$container
156-
->expects($this->atLeastOnce())
157-
->method('get')
158-
->with($this->equalTo('event_dispatcher'))
159-
->will($this->returnValue($dispatcher))
160-
;
129+
130+
if ($useDispatcher) {
131+
$dispatcher =$this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
132+
$dispatcher
133+
->expects($this->atLeastOnce())
134+
->method('dispatch')
135+
;
136+
$container
137+
->expects($this->atLeastOnce())
138+
->method('get')
139+
->with($this->equalTo('event_dispatcher'))
140+
->will($this->returnValue($dispatcher));
141+
}
142+
161143
$container
162144
->expects($this->once())
163145
->method('hasParameter')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp