/** * Test runtime exception. * * Calling run() when both a logger and a router are given must * not throw any exception. */ public function testNoRuntimeExceptionWhenBothSet() { // Call run with both does not trigger any error. $logger = $this->mockLogger(); $router = $this->mockRouter(); $wind = new EndPoint($logger, $router); try { $wind->run(); $this->assertTrue(true, "No exception was triggered."); } catch (Exception $e) { $this->assertTrue(false, "Calling run with a logger and a router triggered an exception."); } }
<?php /** * @file * Sample script for launching Wind as a REST server. * * This script launches a sample Wind server and stores all log request * to a file called log.log. This script requires the Monolog library. * * (c) Wouter Admiraal <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ require './../../vendor/autoload.php'; use Monolog\Logger; use Monolog\Handler\StreamHandler; use Wind\Server\EndPoint; use Wind\Server\Router; try { $logger = new Logger('name'); $logger->pushHandler(new StreamHandler('./log.log', Logger::DEBUG)); } catch (Exception $e) { die("This example script requires Monolog. Aborting."); } $wind = new EndPoint($logger, new Router()); $wind->run();