• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP TestController类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中TestController的典型用法代码示例。如果您正苦于以下问题:PHP TestController类的具体用法?PHP TestController怎么用?PHP TestController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: onReceive

 public function onReceive($server, $fd, $fromId, $data)
 {
     //echo "receive \n";
     $tttt = new Schedule();
     $test = new TestController($server, $fd, $fromId, array());
     $tttt->add($test->test());
 }
开发者ID:learsu,项目名称:php-swoole-framework,代码行数:7,代码来源:testTcpServ.php


示例2: testOutput

 public function testOutput()
 {
     $obj = new TestController('id', Yii::$app);
     $this->assertEquals(0, $obj->outputInfo('info'));
     $this->assertEquals(0, $obj->outputSuccess('success'));
     $this->assertEquals(1, $obj->outputError('error'));
 }
开发者ID:luyadev,项目名称:luya,代码行数:7,代码来源:ControllerTest.php


示例3: form_appears_and_saves

 /**
  * @test
  */
 public function form_appears_and_saves()
 {
     Config::inst()->update('Controller', 'extensions', array('QuickFeedbackExtension'));
     $controller = new TestController();
     $result = $controller->handleRequest(new SS_HTTPRequest('GET', 'form_appears_and_saves'), DataModel::inst());
     $body = $result->getBody();
     $this->assertContains('Form_QuickFeedbackForm', $body);
     $this->assertContains('Form_QuickFeedbackForm_Rating', $body);
     $this->assertContains('Form_QuickFeedbackForm_Comment', $body);
     preg_match('/action="([^"]+)"/', $body, $action);
     if (!count($action)) {
         $this->fail('No form action');
     }
     preg_match('/name="SecurityID" value="([^"]+)"/', $body, $token);
     if (!count($action)) {
         $this->fail('No token');
     }
     $parts = explode('/', $action[1]);
     $action = end($parts);
     $time = time();
     $data = ['SecurityID' => $token[1], 'Rating' => '0', 'Comment' => 'comment at ' . $time];
     $controller->handleRequest(new SS_HTTPRequest('POST', $action, array(), $data), DataModel::inst());
     $existing = Feedback::get()->filter('Comment', 'comment at ' . $time)->first();
     if (!$existing) {
         $this->fail('Record missing');
     }
 }
开发者ID:helpfulrobot,项目名称:mandrew-silverstripe-quickfeedback,代码行数:30,代码来源:QuickFeedbackExtensionTest.php


示例4: runIndex

 public function runIndex($searchValue, $formInput, $returnValue, $returnValue2 = null, $returnValue3 = null)
 {
     Input::replace($formInput);
     $controller = new TestController();
     $view = $controller->index();
     $tests = $view->getData()['testSet'];
     if (isset($returnValue3)) {
         $field3 = $returnValue3;
         $field2 = $returnValue2;
     } elseif (isset($returnValue2)) {
         $field2 = $returnValue2;
     }
     $field = $returnValue;
     if (is_numeric($searchValue) && $field == 'specimen_id' | $field == 'visit_id') {
         if ($searchValue == '0') {
             $this->assertEquals($searchValue, count($tests));
         } else {
             $this->assertGreaterThanOrEqual(1, count($tests));
         }
     } else {
         foreach ($tests as $key => $test) {
             if (isset($field3)) {
                 $this->assertEquals($searchValue, $test->{$field}->{$field2}->{$field3});
             } elseif (isset($field2)) {
                 $this->assertEquals($searchValue, $test->{$field}->{$field2});
             } else {
                 $this->assertEquals($searchValue, $test->{$field});
             }
         }
     }
 }
开发者ID:BaobabHealthTrust,项目名称:iBLIS,代码行数:31,代码来源:TestControllerTest.php


示例5: onReceive

 public function onReceive($server, $fd, $fromId, $data)
 {
     $tttt = new Schedule();
     $test = new TestController($server, $fd, array());
     $tttt->add($test->test());
     $tttt->run();
     $this->server->send($fd, $data);
 }
开发者ID:learsu,项目名称:php-swoole-framework,代码行数:8,代码来源:testUdpServ.php


示例6: testCacheKeyNoRequestParams

 /**
  * Test cache key, no params
  * @TODO Possibly load the resulting markup as a DOM object and test various children in it; this would enforce valid markup
  */
 function testCacheKeyNoRequestParams()
 {
     $config = Config::getInstance();
     $config->setValue('cache_pages', true);
     $controller = new TestController(true);
     $results = $controller->go();
     $this->assertEqual($controller->getCacheKeyString(), '');
 }
开发者ID:prop7,项目名称:thinktank,代码行数:12,代码来源:TestOfTestController.php


示例7: testDispatch

 public function testDispatch()
 {
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $ctr = new TestController();
     $ctr->theme = $this->getMock('Theme', ['render']);
     $ctr->theme->expects($this->once())->method('render');
     $ctr->dispatch('test1');
     $this->assertEquals(1, $ctr->test1);
 }
开发者ID:hawkao,项目名称:mew,代码行数:9,代码来源:ContollerTest.php


示例8: testHeader

 function testHeader()
 {
     ob_start();
     $test = new TestController();
     $test->update();
     $output = ob_get_contents();
     ob_end_clean();
     $this->assertTrue(in_array("Location: http://google.com", $test->header));
 }
开发者ID:hurrycane,项目名称:framework,代码行数:9,代码来源:controller_tests.php


示例9: testResponse

 /**
  * Test that the Controller response object is working properly for get/set/unset of a controller property
  */
 public function testResponse()
 {
     $controller = new TestController();
     $response = new WikiaResponse('html');
     // setResponse and getResponse
     $controller->setResponse($response);
     $this->assertEquals($response, $controller->getResponse());
     // setVal and getVal
     $controller->foo = 'foo';
     $this->assertFalse(empty($controller->foo));
     $this->assertEquals($controller->foo, 'foo');
     // unset
     unset($controller->foo);
     $this->assertTrue(empty($controller->foo));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:18,代码来源:WikiaControllerTest.php


示例10: testRunAction

 public function testRunAction()
 {
     $app = new TestApplication();
     $c = new TestController('test');
     $this->assertEquals($c->internal, 0);
     $this->assertEquals($c->external, 0);
     $this->assertEquals($c->internalFilter1, 0);
     $this->assertEquals($c->internalFilter2, 0);
     $this->assertEquals($c->internalFilter3, 0);
     $this->assertEquals($c->externalFilter, 0);
     $c->run('');
     $this->assertEquals($c->internal, 0);
     $this->assertEquals($c->external, 1);
     $this->assertEquals($c->internalFilter1, 1);
     $this->assertEquals($c->internalFilter2, 0);
     $this->assertEquals($c->internalFilter3, 1);
     $this->assertEquals($c->externalFilter, 1);
     $c->run('internal');
     $this->assertEquals($c->internal, 1);
     $this->assertEquals($c->external, 1);
     $this->assertEquals($c->internalFilter1, 2);
     $this->assertEquals($c->internalFilter2, 1);
     $this->assertEquals($c->internalFilter3, 1);
     $this->assertEquals($c->externalFilter, 2);
     $c->run('external');
     $this->assertEquals($c->internal, 1);
     $this->assertEquals($c->external, 1);
     $this->assertEquals($c->internalFilter1, 3);
     $this->assertEquals($c->internalFilter2, 1);
     $this->assertEquals($c->internalFilter3, 1);
     $this->assertEquals($c->externalFilter, 2);
     $this->setExpectedException('CException');
     $c->run('unknown');
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:34,代码来源:CControllerTest.php


示例11: testActionClassDiffNameAndParams

 public function testActionClassDiffNameAndParams()
 {
     global $testquery, $testpost;
     $testquery = array();
     $testpost = array();
     $testpost['userid'] = 'johnsmith';
     $testpost['user_Name'] = 'john';
     $testpost['user_Age'] = '22';
     $testpost['user_Hcp'] = '10,7';
     $tc = new TestController();
     $tc->init();
     $tc->executeAction('paramsClassAndParam2');
     $this->assertInstanceOf('Person', $tc->person);
     $this->assertEquals('john', $tc->person->Name);
     $this->assertEquals('johnsmith', $tc->userid);
 }
开发者ID:ArtOfWP,项目名称:CloudLess,代码行数:16,代码来源:BaseControllerTest.php


示例12: test_post_reauthenticate_returns_redirect

 public function test_post_reauthenticate_returns_redirect()
 {
     $user = new TestUser();
     $user->password = bcrypt('test');
     Auth::shouldReceive('user')->once()->andReturn($user);
     Session::set('url.intended', 'http://reauthenticate.app/auth/reauthenticate');
     $request = \Illuminate\Http\Request::create('http://reauthenticate.app/auth/reauthenticate', 'POST', ['password' => 'test']);
     $request->setSession(app('session.store'));
     $controller = new TestController();
     /** @var Illuminate\Http\RedirectResponse $response */
     $response = $controller->postReauthenticate($request);
     $this->assertInstanceOf(Illuminate\Http\RedirectResponse::class, $response);
     $this->assertEquals('http://reauthenticate.app/auth/reauthenticate', $response->getTargetUrl());
     $this->assertTrue(Session::has('reauthenticate.life'));
     $this->assertTrue(Session::has('reauthenticate.authenticated'));
     $this->assertTrue(Session::get('reauthenticate.authenticated'));
 }
开发者ID:JamesForks,项目名称:reauthenticate,代码行数:17,代码来源:ReauthenticateControllerTest.php


示例13: addRoutes

 static function addRoutes($app, $authenticateForRole)
 {
     //* /test/ routes - publicly accessable test route
     $app->group('/api-test', $authenticateForRole('public'), function () use($app) {
         $app->map("/get/status/", function () use($app) {
             TestController::getApiStatus($app);
         })->via('GET', 'POST');
     });
 }
开发者ID:rachellcarbone,项目名称:angular-seed,代码行数:9,代码来源:test.routes.php


示例14: testARBGetSubscriptionList

 public function testARBGetSubscriptionList()
 {
     $this->markTestSkipped('Ignoring for Travis. Will fix after release.');
     //TODO
     $name = defined('AUTHORIZENET_API_LOGIN_ID') && '' != AUTHORIZENET_API_LOGIN_ID ? AUTHORIZENET_API_LOGIN_ID : getenv("api_login_id");
     $transactionKey = defined('AUTHORIZENET_TRANSACTION_KEY') && '' != AUTHORIZENET_TRANSACTION_KEY ? AUTHORIZENET_TRANSACTION_KEY : getenv("transaction_key");
     $merchantAuthentication = new net\authorize\api\contract\v1\MerchantAuthenticationType();
     $merchantAuthentication->setName($name);
     $merchantAuthentication->setTransactionKey($transactionKey);
     //$merchantAuthentication->setMobileDeviceId()
     $refId = 'ref' . time();
     $sorting = new net\authorize\api\contract\v1\ARBGetSubscriptionListSortingType();
     $sorting->setOrderBy('firstName');
     $sorting->setOrderDescending(false);
     $paging = new net\authorize\api\contract\v1\PagingType();
     $paging->setLimit(10);
     $paging->setOffset(1);
     $request = new net\authorize\api\contract\v1\ARBGetSubscriptionListRequest();
     $request->setSearchType('subscriptionActive');
     $request->setRefId($refId);
     $request->setSorting($sorting);
     $request->setPaging($paging);
     $request->setMerchantAuthentication($merchantAuthentication);
     //$controller = new ApiOperationBase($request, 'net\authorize\api\contract\v1\ARBGetSubscriptionListResponse');
     $controller = new TestController($request);
     $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
     // Handle the response.
     $this->assertNotNull($response, "null response");
     $this->assertNotNull($response->getMessages());
     $this->assertEquals("Ok", $response->getMessages()->getResultCode());
     $this->assertEquals($response->getRefId(), $refId);
     $this->assertTrue(0 < count($response->getMessages()));
     foreach ($response->getMessages() as $message) {
         $this->assertEquals("I00001", $message->getCode());
         $this->assertEquals("Successful.", $response->getText());
     }
 }
开发者ID:hoa32811,项目名称:wp_thanhtrung_hotel,代码行数:37,代码来源:Controller_Test.php


示例15: initController

 public static function initController()
 {
     TestController::$control = new TestController();
 }
开发者ID:Baki92,项目名称:ChunPhpFramework,代码行数:4,代码来源:TestController.php


示例16: testGetTasks

 /**
  * Test JController::getTasks
  *
  * @covers  JController::getTasks
  */
 public function testGetTasks()
 {
     $class = new TestController();
     // The available tasks should be the public tasks in the derived controller plus "display".
     $this->assertEquals(array('task1', 'task2', 'display'), $class->getTasks());
 }
开发者ID:nogsus,项目名称:joomla-platform,代码行数:11,代码来源:JControllerTest.php


示例17: testGetTasks

	/**
	 * Test JController::getTasks
	 */
	public function testGetTasks()
	{
		$controller = new TestController;

		$this->assertThat(
			$controller->getTasks(),
			$this->equalTo(
				array(
					'task1', 'task2', 'display'
				)
			),
			'Line:'.__LINE__.' The available tasks should be the public tasks in the derived controller plus "display".'
		);
	}
开发者ID:realityking,项目名称:JAJAX,代码行数:17,代码来源:JControllerTest.php


示例18: testCalcCategoriesScore

 public function testCalcCategoriesScore()
 {
     $questions = array('1' => array('category' => '1', 'score' => 1.5, 'weight' => 3), '2' => array('category' => '2', 'score' => 0.5, 'weight' => 1), '3' => array('category' => '1', 'score' => 1.0, 'weight' => 1), '4' => array('category' => '2', 'score' => 1.0, 'weight' => 2));
     $category = array('1' => 'category1', '2' => 'category2');
     $expectation = array('category1' => 75, 'category2' => 50);
     $this->assertEquals($expectation, TestController::calcCategoriesScore($questions, $category));
 }
开发者ID:eugenzor,项目名称:zfhrtool,代码行数:7,代码来源:TestControllerTest.php


示例19: function

<?php

/**
 * This is a Anax frontcontroller.
 *
 */
// Get environment & autoloader.
require __DIR__ . '/../config.php';
// Create services and inject into the app.
$di = new \Anax\DI\CDIFactoryTest();
$app = new \Anax\Kernel\CAnax($di);
$di->set('TestController', function () use($di) {
    $controller = new TestController();
    $controller->setDI($di);
    return $controller;
});
class TestController
{
    use \Anax\DI\TInjectable;
    public function indexAction()
    {
        $this->theme->setTitle("How verbose is the error reporting");
        $this->views->add('default/page', ['title' => "Testing error reporting from Anax MVC", 'content' => "Trying out some missusage of Anax MVC to see if the errors are easy to understand.", 'links' => [['href' => $this->url->create('t1'), 'text' => "Using not defined service as property of \$app"], ['href' => $this->url->create('t2'), 'text' => "Using not defined service as method of \$app"], ['href' => $this->url->create('t3'), 'text' => "Forward to non-existing controller"], ['href' => $this->url->create('t4'), 'text' => "Forward to non-existing action"], ['href' => $this->url->create('test/no-di-call'), 'text' => "Using TInjectable forgot to set \$di, accessing session() via __call()"], ['href' => $this->url->create('test/no-di-get'), 'text' => "Using TInjectable forgot to set \$di, accessing session via __get()"], ['href' => $this->url->create('test/no-such-service-property'), 'text' => "Using TInjectable forgot to set \$di, accessing session() via __call()"], ['href' => $this->url->create('test/no-such-service-method'), 'text' => "Using TInjectable forgot to set \$di, accessing session via __get()"]]]);
    }
    public function noDiCallAction()
    {
        $this->di = null;
        $this->session();
    }
    public function noDiGetAction()
    {
开发者ID:rcus,项目名称:phpmvc,代码行数:31,代码来源:error-message-verbosity.php


示例20: testInvokeActionReturnValue

 /**
  * test invoking controller methods.
  *
  * @return void
  */
 public function testInvokeActionReturnValue()
 {
     $url = new CakeRequest('test/returner/');
     $url->addParams(array('controller' => 'test_controller', 'action' => 'returner', 'pass' => array()));
     $response = $this->getMock('CakeResponse');
     $Controller = new TestController($url, $response);
     $result = $Controller->invokeAction($url);
     $this->assertEquals('I am from the controller.', $result);
 }
开发者ID:abhinand4858,项目名称:ProgrammedV,代码行数:14,代码来源:ControllerTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP TestDataService类代码示例发布时间:2022-05-23
下一篇:
PHP TestCaseDatabase类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap