当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::terminate方法代码示例

本文整理汇总了PHP中Silex\Application::terminate方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::terminate方法的具体用法?PHP Application::terminate怎么用?PHP Application::terminate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Silex\Application的用法示例。


在下文中一共展示了Application::terminate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Run react.
  *
  * @param int    $port
  * @param string $host
  */
 public function run($port, $host)
 {
     $request_handler = function (Request $request, Response $response) {
         echo $request->getMethod() . ' ' . $request->getPath() . PHP_EOL;
         $sf_request = $this->request_bridge->convertRequest($request);
         $sf_response = $this->app->handle($sf_request);
         $this->app->terminate($sf_request, $sf_response);
         $this->response_bridge->send($response, $sf_response);
     };
     $this->http->on('request', $request_handler);
     $this->socket->listen($port, $host);
     $this->loop->run();
 }
开发者ID:KEIII,项目名称:react-silex,代码行数:19,代码来源:ReactServer.php

示例2: testModelManagerServiceIsAvailable

 /**
  * test model service is available
  */
 public function testModelManagerServiceIsAvailable()
 {
     $app = new Application();
     $app->register(new ModelProvider(), array('model.finder.namespace' => 'Fake\\NameSpace', 'model.finder.path' => '/tmp/fake'));
     $mockStorage = $this->getMock('Skip\\Model\\ModelStorageHandlerInterface');
     $app['model.storage.handlers'] = array('mock.storage' => $mockStorage);
     $modelManager = $app['model'];
     $this->assertInstanceOf('Skip\\Model\\Manager', $modelManager);
     $request = Request::createFromGlobals();
     $response = $app->handle($request);
     $app->terminate($request, $response);
 }
开发者ID:renegare,项目名称:skip-model,代码行数:15,代码来源:ModelProviderTest.php

示例3: eventHelpersShouldDirectlyAddListenersAfterBoot

 /** @test */
 public function eventHelpersShouldDirectlyAddListenersAfterBoot()
 {
     $app = new Application();
     $fired = false;
     $app->get("/", function () use($app, &$fired) {
         $app->finish(function () use(&$fired) {
             $fired = true;
         });
     });
     $request = Request::create('/');
     $response = $app->handle($request);
     $app->terminate($request, $response);
     $this->assertTrue($fired, 'Event was not fired');
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:15,代码来源:LazyDispatcherTest.php

示例4: testSwiftMailerSendsMailsOnFinish

 public function testSwiftMailerSendsMailsOnFinish()
 {
     $app = new Application();
     $app->register(new SwiftmailerServiceProvider());
     $app->boot();
     $app['swiftmailer.spool'] = $app->share(function () {
         return new SpoolStub();
     });
     $app->get('/', function () use($app) {
         $app['mailer']->send(\Swift_Message::newInstance());
     });
     $this->assertCount(0, $app['swiftmailer.spool']->getMessages());
     $request = Request::create('/');
     $response = $app->handle($request);
     $this->assertCount(1, $app['swiftmailer.spool']->getMessages());
     $app->terminate($request, $response);
     $this->assertCount(0, $app['swiftmailer.spool']->getMessages());
 }
开发者ID:nlegoff,项目名称:Silex,代码行数:18,代码来源:SwiftmailerServiceProviderTest.php

示例5: testSwiftMailerAvoidsFlushesIfMailerIsUnused

 public function testSwiftMailerAvoidsFlushesIfMailerIsUnused()
 {
     $app = new Application();
     $app->register(new SwiftmailerServiceProvider());
     $app->boot();
     $app['swiftmailer.spool'] = $app->share(function () {
         return new SpoolStub();
     });
     $app->get('/', function () use($app) {
     });
     $request = Request::create('/');
     $response = $app->handle($request);
     $this->assertCount(0, $app['swiftmailer.spool']->getMessages());
     $app->terminate($request, $response);
     $this->assertFalse($app['swiftmailer.spool']->hasFlushed);
 }
开发者ID:assistechnologie,项目名称:webui,代码行数:16,代码来源:SwiftmailerServiceProviderTest.php

示例6: testSwiftMailerSendsMailsOnFinish

 public function testSwiftMailerSendsMailsOnFinish()
 {
     $app = new Application();
     $app->register(new SwiftmailerServiceProvider(), array('swiftmailer.class_path' => __DIR__ . '/../../../../vendor/swiftmailer/swiftmailer/lib/classes'));
     $spool = new SpoolStub();
     $app['swiftmailer.spooltransport'] = new \Swift_SpoolTransport($spool);
     $app->get('/', function () use($app) {
         $app['mailer']->send(\Swift_Message::newInstance());
     });
     $this->assertCount(0, $spool->getMessages());
     $request = Request::create('/');
     $response = $app->handle($request);
     $this->assertCount(1, $spool->getMessages());
     $app->terminate($request, $response);
     $this->assertCount(0, $spool->getMessages());
 }
开发者ID:nicodmf,项目名称:Silex,代码行数:16,代码来源:SwiftmailerServiceProviderTest.php

示例7: testCallbacksAsServices

 public function testCallbacksAsServices()
 {
     $app = new Application();
     $app['service'] = $app->share(function () {
         return new self();
     });
     $app->before('service:beforeApp');
     $app->after('service:afterApp');
     $app->finish('service:finishApp');
     $app->error('service:error');
     $app->on('kernel.request', 'service:onRequest');
     $app->match('/', 'service:controller')->convert('foo', 'service:convert')->before('service:before')->after('service:after');
     $request = Request::create('/');
     $response = $app->handle($request);
     $app->terminate($request, $response);
     $this->assertEquals(array('CONVERT', 'BEFORE APP', 'ON REQUEST', 'BEFORE', 'ERROR', 'AFTER', 'AFTER APP', 'FINISH APP'), $app['service']->called);
 }
开发者ID:syntropysoftware,项目名称:cryptoffice-frontend,代码行数:17,代码来源:CallbackServicesTests.php


注:本文中的Silex\Application::terminate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。