Added a test case to demonstrate the fatal error occuring when a Bundle implementing BundleInterface only is registered in the kernel.
Only call registerCommand on bundles that is an instance of Bundle

Fixes GH-5133
merged branch web-dev/bundle-interface-command-fatal-error (PR #5133)

Commits
-------

30bcb57 Added a test case to demonstrate the fatal error occuring when a Bundle implementing BundleInterface only is registered in the kernel.

Discussion
----------

Fatal error in FrameworkBundle console application

A fatal error is generated in the `FrameworkBundle` console application when a bundle is added implementing [`BundleInterface`](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php)

This is because the method `registerCommands` does not exist on this interface and is instead only defined on the concrete [`Bundle`](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Bundle/Bundle.php#L173) implementation.

The workaround for this issue is simple - implement an empty method for `registerCommands` in the bundle implementation so that the fatal error is not triggered.

However this issue should probably be fixed by either restricting bundles to the Bundle class or expanding the `BundleInterface` to include the `registerCommands` method signature. Both of these fixes will introduce a BC break into the API so I would suggest creating a fix for 2.0 which includes method detection in the `registerCommands` method of the [`Console\Application`](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Console/Application.php#L80) class.

I'm happy to submit the fix for this - however I would like some direction from the SF2 dev team as to which way they would like to resolve this.

The PR currently only contains a unit test that proves this behaviour.

---------------------------------------------------------------------------

by travisbot at 2012-08-01T02:42:55Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2006350) (merged 30bcb572 into 1da896dc).

---------------------------------------------------------------------------

by henrikbjorn at 2012-08-01T05:50:16Z

I am thinking a instanceof check might be the most reasonable in this case. But in master it should proberly be fixed by adding the method to the interface.

/cc @stof any comments if that is to be done?

---------------------------------------------------------------------------

by stof at 2012-08-01T08:53:02Z

yeah, for 2.0, we cannot change the interface.
merged branch henrikbjorn/2.0 (PR #5137)

Commits
-------

0b78fdf Only call registerCommand on bundles that is an instance of Bundle

Discussion
----------

Only call registerCommand on bundles that is an instance of Bundle

Fixes GH-5133

---------------------------------------------------------------------------

by travisbot at 2012-08-01T09:41:05Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2008252) (merged 0b78fdff into 1da896dc).

---------------------------------------------------------------------------

by henrikbjorn at 2012-08-01T10:05:00Z

Build failed because of HTTP request error.

---------------------------------------------------------------------------

by lsmith77 at 2012-08-01T11:31:08Z

wondering if it would be good if you could include the commit from #5133 in this PR .. then we get the test and the fix at once.