'subCommands is built from IServiceMaker plugins, and is sorted
alphabetically.'

def test_subCommands(self):

    class FakePlugin(object, ):
        def __init__(self, name):
            self.tapname = name
            self._options = ('options    for    ' + name)
            self.description = ('description    of    ' + name)
        def options(self):
            return self._options
    apple = FakePlugin('apple')
    banana = FakePlugin('banana')
    coconut = FakePlugin('coconut')
    donut = FakePlugin('donut')
    def getPlugins(interface):
        self.assertEqual(interface, IServiceMaker)
        (yield coconut)
        (yield banana)
        (yield donut)
        (yield apple)
    config = twistd.ServerOptions()
    self.assertEqual(config._getPlugins, plugin.getPlugins)
    config._getPlugins = getPlugins
    subCommands = config.subCommands
    expectedOrder = [apple, banana, coconut, donut]
    for (subCommand, expectedCommand) in zip(subCommands, expectedOrder):
        (name, shortcut, parserClass, documentation) = subCommand
        self.assertEqual(name, expectedCommand.tapname)
        self.assertIsNone(shortcut)
        (self.assertEqual(parserClass(), expectedCommand._options),)
        self.assertEqual(documentation, expectedCommand.description)
