function testMultipleMaintenanceObjectsInteractionCleanupChanneledWChannel() { $m2 = new MaintenanceFixup($this); $this->m->outputChanneled("foo", "bazChannel"); $m2->outputChanneled("bar", "bazChannel"); $this->assertEquals("foobar", $this->getActualOutput(), "Output before first cleanup"); $this->m->cleanupChanneled(); $this->assertEquals("foobar\n", $this->getActualOutput(), "Output after first cleanup"); $m2->cleanupChanneled(); $this->assertEquals("foobar\n\n", $this->getActualOutput(), "Output after second cleanup"); $m2->simulateShutdown(); $this->assertOutputPrePostShutdown("foobar\n\n", false); }
function testParseArgs() { $m2 = new MaintenanceFixup($this); // Create an option with an argument allowed to be specified multiple times $m2->addOption('multi', 'This option does stuff', false, true, false, true); $m2->loadWithArgv(['--multi', 'this1', '--multi', 'this2']); $this->assertEquals(['this1', 'this2'], $m2->getOption('multi')); $this->assertEquals([['multi', 'this1'], ['multi', 'this2']], $m2->orderedOptions); $m2->simulateShutdown(); $m2 = new MaintenanceFixup($this); $m2->addOption('multi', 'This option does stuff', false, false, false, true); $m2->loadWithArgv(['--multi', '--multi']); $this->assertEquals([1, 1], $m2->getOption('multi')); $this->assertEquals([['multi', 1], ['multi', 1]], $m2->orderedOptions); $m2->simulateShutdown(); $m2 = new MaintenanceFixup($this); // Create an option with an argument allowed to be specified multiple times $m2->addOption('multi', 'This option doesn\'t actually support multiple occurrences'); $m2->loadWithArgv(['--multi=yo']); $this->assertEquals('yo', $m2->getOption('multi')); $this->assertEquals([['multi', 'yo']], $m2->orderedOptions); $m2->simulateShutdown(); }