/** * ShellMessagesHandler constructor. * @param JupyterBroker $broker * @param SocketWrapper $iopubSocket * @param SocketWrapper $shellSocket * @param Logger $logger */ public function __construct(JupyterBroker $broker, SocketWrapper $iopubSocket, SocketWrapper $shellSocket, Logger $logger) { $this->shellSoul = new Shell(); $this->executeAction = new ExecuteAction($broker, $iopubSocket, $shellSocket, $this->shellSoul); $this->historyAction = new HistoryAction($broker, $shellSocket); $this->kernelInfoAction = new KernelInfoAction($broker, $shellSocket, $iopubSocket); $this->shutdownAction = new ShutdownAction($broker, $shellSocket); $this->logger = $logger; $broker->send($iopubSocket, 'status', ['execution_state' => 'starting'], []); $this->shellSoul->setOutput(new KernelOutput($this->executeAction, $this->logger->withName('KernelOutput'))); }
/** * @dataProvider getRenderedExceptions */ public function testWriteException($exception, $expected) { $output = $this->getOutput(); $stream = $output->getStream(); $shell = new Shell($this->getConfig()); $shell->setOutput($output); $shell->writeException($exception); rewind($stream); $this->assertEquals($expected, stream_get_contents($stream)); }