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


PHP ComponentCollection::init方法代码示例

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


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

示例1: generateComponent

 /**
  * Generates the component for test
  * Options:
  * - mocks: specify mock methods for each objects
  * - componentOptopns: could be used for component options.
  *
  * @param $options
  * @return void
  */
 public function generateComponent($options = [])
 {
     $options = Hash::merge(['mocks' => ['controller' => ['_stop', 'redirect']], 'componentOptions' => ['setDebuggerTypeAs' => false, 'setExceptionHandler' => false, 'setAuthenticate' => false], 'initialize' => true], $options);
     extract($options);
     $this->request = $this->getMockBuilder('CakeRequest')->setConstructorArgs(['/', false])->setMethods(Hash::get($mocks, 'request'))->getMock();
     $this->response = $this->getMockBuilder('CakeResponse')->setMethods(Hash::get($mocks, 'response'))->getMock();
     $this->controller = $this->getMockBuilder('Controller')->setConstructorArgs([$this->request, $this->response])->setMethods(Hash::get($mocks, 'controller'))->getMock();
     $this->collection = $this->getMockBuilder('ComponentCollection')->setMethods(Hash::get($mocks, 'collection'))->getMock();
     $this->collection->init($this->controller);
     $this->Api = $this->getMockBuilder('ApiComponent')->setConstructorArgs([$this->collection, $componentOptions])->setMethods(Hash::get($mocks, 'Api'))->getMock();
     if ($initialize) {
         $this->Api->initialize($this->controller);
     }
     return $this->Api;
 }
开发者ID:hiromi2424,项目名称:api,代码行数:24,代码来源:ApiComponentTest.php

示例2: setUp

 public function setUp()
 {
     parent::setUp();
     $this->Controller = new EnummPostsController();
     $collection = new ComponentCollection();
     $collection->init($this->Controller);
 }
开发者ID:k1low,项目名称:enumm,代码行数:7,代码来源:EnummComponentTest.php

示例3: setUp

 public function setUp()
 {
     $this->Controller = $this->getMock('AccessLimitTestController', array('dispatchMethod'), array($this->getMock('CakeRequest', array('is'), array(null, false)), $this->getMock('CakeResponse')));
     $this->Model = $this->getMockForModel('Security.AccessLimit');
     ClassRegistry::addObject('AccessLimit', $this->Model);
     $collection = new ComponentCollection();
     $collection->init($this->Controller);
     $this->Controller->Components->init($this->Controller);
     $this->AccessLimit = $this->Controller->AccessLimit;
 }
开发者ID:gourmet,项目名称:security,代码行数:10,代码来源:AccessLimitComponentTest.php

示例4: setUp

 public function setUp()
 {
     parent::setUp();
     $request = new CakeRequest(null, false);
     $request->params['ext'] = 'json';
     $this->Controller = new TestRestController($request, $this->getMock('CakeResponse'));
     $collection = new ComponentCollection();
     $collection->init($this->Controller);
     $this->Rest = new MockRestComponent($collection, $this->settings);
     $this->Rest->request = $request;
     $this->Rest->response = $this->getMock('CakeResponse');
     $this->Controller->Components->init($this->Controller);
 }
开发者ID:kvz,项目名称:cakephp-rest-plugin,代码行数:13,代码来源:RestComponentTest.php

示例5: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $request = new CakeRequest(null, false);
     $this->Controller = new UploaderTestController($request, $this->getMock('CakeResponse'));
     $collection = new ComponentCollection();
     $collection->init($this->Controller);
     $this->Uploader = new TestUploaderComponent($collection);
     $this->Controller->Components->init($this->Controller);
     $this->Controller->startupProcess();
     $this->upload1 = array('name' => 'Upload.jpg', 'type' => 'image/jpg', 'tmp_name' => $this->tmpDir . 'upload.jpg', 'error' => (int) 0, 'size' => filesize($this->tmpDir . 'upload.jpg'));
     $this->upload2 = array('name' => 'Upload File 2.txt', 'type' => 'text/plain', 'tmp_name' => $this->tmpDir . 'upload2.txt', 'error' => (int) 0, 'size' => filesize($this->tmpDir . 'upload2.txt'));
     $this->MediaUpload = ClassRegistry::init('MediaUpload');
     $this->Controller->Uploader->setModel($this->MediaUpload);
     $this->uploadResult = null;
 }
开发者ID:fm-labs,项目名称:cakephp-media,代码行数:21,代码来源:UploaderComponentTest.php

示例6: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     // Ensure all requests start with a valid token attached.
     $token = 'cc0a91cfa4f3b703531c1dc4f5f64b89';
     $request = $this->getMock('CakeRequest', array('header'), array(null, false));
     $request->staticExpects($this->any())->method('header')->with('Authorization')->will($this->returnValue('Bearer ' . $token));
     $this->Controller = new StatelessAuthController($request, $this->getMock('CakeResponse'));
     $this->Controller->request = $request;
     $collection = new ComponentCollection();
     $collection->init($this->Controller);
     $this->Component = new TestStatelessAuthComponent($collection);
     $this->Component->request = $request;
     $this->Component->response = $this->getMock('CakeResponse');
     $this->Controller->Components->init($this->Controller);
 }
开发者ID:loadsys,项目名称:cakephp-stateless-auth,代码行数:21,代码来源:StatelessAuthComponentTest.php

示例7: setUp

 public function setUp()
 {
     parent::setUp();
     // コンポーネントと偽のテストコントローラをセットアップする
     $request = new CakeRequest();
     $response = $this->getMock('CakeResponse');
     $this->Controller = new BcReplacePrefixTestController($request, $response);
     $collection = new ComponentCollection();
     $collection->init($this->Controller);
     $this->BcReplacePrefix = new BcReplacePrefixComponent($collection);
     $this->BcReplacePrefix->request = $request;
     $this->BcReplacePrefix->response = $response;
     $this->Controller->Components->init($this->Controller);
     Router::reload();
     Router::connect('/:controller/:action/*');
 }
开发者ID:baserproject,项目名称:basercms,代码行数:16,代码来源:BcReplacePrefixComponentTest.php

示例8: setUp

 public function setUp()
 {
     @session_start();
     parent::setUp();
     // コンポーネントと偽のコントローラをセットアップする
     $request = new CakeRequest();
     $response = $this->getMock('CakeResponse');
     $this->Controller = new BcAuthConfigureTestController($request, $response);
     $collection = new ComponentCollection();
     $collection->init($this->Controller);
     $this->BcAuthConfigure = new BcAuthConfigureComponent($collection);
     $this->BcAuthConfigure->request = $request;
     $this->BcAuthConfigure->response = $response;
     $this->Controller->Components->init($this->Controller);
     Router::reload();
     Router::connect('/:controller/:action/*');
 }
开发者ID:baserproject,项目名称:basercms,代码行数:17,代码来源:BcAuthConfigureComponentTest.php

示例9: testConstructionMissing

 public function testConstructionMissing()
 {
     $collection = new ComponentCollection();
     $collection->init($this->Controller);
     $this->setExpectedException('PermitException');
     $testPermit = new TestPermitComponent($collection, array('path' => 'MockAuthTest', 'check' => 'id', 'isTest' => false, 'permit_include_path' => dirname(__FILE__) . DS . 'Config' . DS . 'permit.php'));
 }
开发者ID:superstarrajini,项目名称:cakepackages,代码行数:7,代码来源:PermitTest.php

示例10: testConstructorSettings

 /**
  * Test that the constructor sets the settings.
  *
  * @return void
  */
 public function testConstructorSettings()
 {
     $settings = array('ajaxLayout' => 'test_ajax', 'viewClassMap' => array('json' => 'MyPlugin.MyJson'));
     $Collection = new ComponentCollection();
     $Collection->init($this->Controller);
     $RequestHandler = new RequestHandlerComponent($Collection, $settings);
     $this->assertEquals('test_ajax', $RequestHandler->ajaxLayout);
     $this->assertEquals(array('json' => 'MyPlugin.MyJson'), $RequestHandler->settings['viewClassMap']);
 }
开发者ID:saihe,项目名称:reservation,代码行数:14,代码来源:RequestHandlerComponentTest.php

示例11: testConstructorSettings

 /**
  * Test that the constructor sets the settings.
  *
  * @return void
  */
 public function testConstructorSettings()
 {
     $settings = array('ajaxLayout' => 'test_ajax');
     $Collection = new ComponentCollection();
     $Collection->init($this->Controller);
     $RequestHandler = new RequestHandlerComponent($Collection, $settings);
     $this->assertEquals('test_ajax', $RequestHandler->ajaxLayout);
 }
开发者ID:pkdevbox,项目名称:app.director,代码行数:13,代码来源:RequestHandlerComponentTest.php

示例12: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $CakeRequest = new CakeRequest(null, false);
     $CakeResponse = $this->getMock('CakeResponse', array('send'));
     $this->Controller = new WizardTestController($CakeRequest, $CakeResponse);
     $ComponentCollection = new ComponentCollection();
     $ComponentCollection->init($this->Controller);
     $this->Controller->Components->init($this->Controller);
     $this->Wizard = $this->Controller->Wizard;
     $this->Wizard->initialize($this->Controller);
 }
开发者ID:proloser,项目名称:cakephp-wizard,代码行数:17,代码来源:WizardComponentTest.php

示例13: setUp

 /**
  * setUp method
  *
  * @access public
  * @return void
  */
 function setUp()
 {
     parent::setUp();
     $this->_server = $_SERVER;
     $this->_env = $_ENV;
     Configure::write('Security.salt', 'YJfIxfs2guVoUubWDYhG93b0qyJfIxfs2guwvniR2G0FgaC9mi');
     Configure::write('Security.cipherSeed', 770011223369876.0);
     $request = new CakeRequest(null, false);
     $this->Controller = new AuthTestController($request);
     $collection = new ComponentCollection();
     $collection->init($this->Controller);
     $this->Auth = new TestAuthComponent($collection);
     $this->Auth->request = $request;
     $this->Auth->response = $this->getMock('CakeResponse');
     $this->Controller->Components->init($this->Controller);
     $this->initialized = true;
     Router::reload();
     ClassRegistry::init('AuthUser')->updateAll(array('password' => '"' . Security::hash('cake', null, true) . '"'));
 }
开发者ID:robotarmy,项目名称:Phog,代码行数:25,代码来源:auth.test.php

示例14: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('Security.salt', 'YJfIxfs2guVoUubWDYhG93b0qyJfIxfs2guwvniR2G0FgaC9mi');
     Configure::write('Security.cipherSeed', 770011223369876);
     $request = new CakeRequest(null, false);
     $this->Controller = new AuthTestController($request, $this->getMock('CakeResponse'));
     $collection = new ComponentCollection();
     $collection->init($this->Controller);
     $this->Auth = new TestAuthComponent($collection);
     $this->Auth->request = $request;
     $this->Auth->response = $this->getMock('CakeResponse');
     $this->Controller->Components->init($this->Controller);
     $this->initialized = true;
     Router::reload();
     Router::connect('/:controller/:action/*');
     $User = ClassRegistry::init('AuthUser');
     $User->updateAll(array('password' => $User->getDataSource()->value(Security::hash('cake', null, true))));
 }
开发者ID:julkar9,项目名称:gss,代码行数:24,代码来源:AuthComponentTest.php

示例15: testInitializeWithAppErrorController

 /**
  * Test initialize with AppError controller
  *
  * @author  Everton Yoshitani <everton@wizehive.com>
  * @since   1.0
  * @return  void
  */
 public function testInitializeWithAppErrorController()
 {
     $Controller = new Controller();
     $Controller->name = 'AppError';
     $Collection = new ComponentCollection();
     $Collection->init($Controller);
     $Component = $this->getMock('Component', array('getController'), array($Collection));
     $ApiPhpAcl = new ApiPhpAcl($Component);
     $this->assertTrue($ApiPhpAcl->initialize($Component));
 }
开发者ID:manzapanza,项目名称:cakephp-api-utils,代码行数:17,代码来源:ApiPhpAclTest.php


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