/**
  * Setup
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     Configure::write('Security.salt', 'not-the-default');
     $this->object = $this->getObjectForTrait('Cake\\Routing\\RequestActionTrait');
 }
 /**
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     $this->Comments = TableRegistry::get('BitmaskedComments');
     $this->Comments->addBehavior('Tools.Bitmasked', ['mappedField' => 'statuses']);
 }
예제 #3
0
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     $this->Comments = TableRegistry::get('JsonableComments');
     $this->Comments->addBehavior('Tools.Jsonable', ['fields' => ['details']]);
 }
예제 #4
0
 /**
  * Test generating code.
  *
  * @return void
  */
 public function testBake()
 {
     Configure::write('App.namespace', 'Bake\\Test\\App');
     $this->Task->expects($this->once())->method('createFile')->with($this->_normalizePath(APP . 'Model/Behavior/ExampleBehavior.php'), $this->stringContains('class ExampleBehavior extends Behavior'));
     $result = $this->Task->bake('Example');
     $this->assertSameAsFile(__FUNCTION__ . '.php', $result);
 }
예제 #5
0
 /**
  * setUp
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('Acl.classname', 'DbAcl');
     Configure::write('Acl.database', 'test');
     $this->Task = $this->getMock('Acl\\AclExtras', ['in', 'out', 'hr', 'createFile', 'error', 'err', 'clear', 'getControllerList']);
 }
 /**
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->event = new Event('Controller.beforeFilter');
     $this->Controller = new UrlComponentTestController(new Request());
     Configure::write('App.fullBaseUrl', 'http://localhost');
 }
예제 #7
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('Acl.classname', __NAMESPACE__ . '\\CachedDbAclTwoTest');
     $this->CachedDb = new CachedDbAclTwoTest();
     Cache::config('tests', ['engine' => 'File', 'path' => TMP, 'prefix' => 'test_']);
 }
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('debug', true);
     Log::drop('stderr');
     Log::drop('stdout');
 }
예제 #9
0
 /**
  * setup test
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->io = $this->getMock('Cake\\Console\\ConsoleIo', [], [], '', false);
     $this->Shell = $this->getMock('Bake\\Shell\\BakeShell', ['in', 'out', 'hr', 'err', 'createFile', '_stop'], [$this->io]);
     Configure::write('App.namespace', 'Bake\\Test\\App');
 }
 /**
  * Test if the index request is authorized.
  *
  * @return void
  */
 public function testIndexNotAuthorized()
 {
     Configure::write('CA.Models.articles', 'Articles');
     $this->get('/admin/posttypes/articles/index');
     $this->assertResponseSuccess();
     $this->assertRedirect('/admin');
 }
예제 #11
0
 /**
  * Merge Configuration
  *
  * @param string $key Configure key
  * @param array $config New configuration to merge
  * @param return array Array of merged configurations
  */
 public static function mergeConfig($key, $config)
 {
     $values = Configure::read($key);
     $values = Hash::merge((array) $values, $config);
     Configure::write($key, $values);
     return $values;
 }
예제 #12
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     $this->View = new UIView();
     $this->View->layout = 'default';
 }
예제 #13
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('Captcha', ['debug' => false]);
     $config = [];
     $this->Math = new MathEngine($config);
 }
예제 #14
0
 public function initialize()
 {
     parent::initialize();
     /**
      * Define Content settings
      */
     Configure::write('Content', ['defaultUsersTable' => 'Users', 'defaultRolesTable' => 'Roles', 'defaultSiteId' => 1]);
     /**
      * Manage site selector
      */
     if ($this->request->is(['patch', 'post', 'put'])) {
         if (isset($this->request->data['current_site_id'])) {
             $this->request->session()->write('Content.currentSiteId', intval($this->request->data['current_site_id']));
         }
     }
     $this->CmsSites = TableRegistry::get('Content.CmsSites');
     $sites = $this->CmsSites->find('all')->toArray();
     $site_selector = [];
     foreach ($sites as $row) {
         $site_selector[$row->id] = $row->name;
         if (!$this->request->session()->check('Content.currentSiteId')) {
             $this->request->session()->write('Content.currentSiteId', $row->id);
         }
     }
     $this->set(compact('site_selector'));
 }
 public function setUp()
 {
     parent::setUp();
     Configure::write('debug', false);
     $this->Articles = TableRegistry::get('Articles');
     $this->Authors = TableRegistry::get('Authors');
 }
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     $this->Table = TableRegistry::get('ResetComments');
     $this->Table->addBehavior('Tools.Reset');
 }
예제 #17
0
 /**
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     $this->Controller = new Controller();
     $this->Controller->startupProcess();
 }
예제 #18
0
 public function setUp()
 {
     parent::setUp();
     Configure::write('Localization', ['decimals' => ',', 'thousands' => '.']);
     Number::config('en_EN');
     $this->Number = new NumberHelper(new View(null));
 }
예제 #19
0
 /**
  * tearDown
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->Shell);
     Configure::write('App.namespace', 'App');
     Plugin::unload();
 }
예제 #20
0
 /**
  * Constructor
  *
  * @param \Cake\Controller\ComponentRegistry $registry The Component registry used on this request.
  * @param array $config Array of config to use.
  * @throws \Exception
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     $oauthConfig = Configure::read('OAuth');
     unset($oauthConfig['providers']['twitter']);
     Configure::write('Muffin/OAuth2', $oauthConfig);
     parent::__construct($registry, array_merge($config, $oauthConfig));
 }
예제 #21
0
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     $this->Controller = new CommonComponentTestController(new Request('/test'));
     $this->Controller->startupProcess();
 }
예제 #22
0
 /**
  * reset environment.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     Plugin::load(array('TestPlugin', 'TestPluginTwo'));
     $this->Case = $this->getMockForAbstractClass('Cake\\TestSuite\\ControllerTestCase');
     $this->Case->loadRoutes = false;
     DispatcherFactory::add('Routing');
     DispatcherFactory::add('ControllerFactory');
     Router::scope('/', function ($routes) {
         $routes->fallbacks();
     });
     Router::prefix('admin', function ($routes) {
         $routes->plugin('TestPlugin', function ($routes) {
             $routes->fallbacks();
         });
         $routes->fallbacks();
     });
     Router::plugin('TestPlugin', function ($routes) {
         $routes->fallbacks();
     });
     Router::plugin('TestPluginTwo', function ($routes) {
         $routes->fallbacks();
     });
     TableRegistry::clear();
 }
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'Spekkoek\\Test\\TestApp');
     $this->factory = new ControllerFactory();
     $this->response = $this->getMock('Cake\\Network\\Response');
 }
예제 #24
0
 public function render($view = null, $layout = null)
 {
     // !IMPORTANT: Render view before initializing CakeTcpdf, because TCPDF sets the encoding to ASCII
     $content = parent::render($view, $layout);
     $pdfParams = $this->get('pdf');
     $this->engine()->SetTitle($pdfParams['title']);
     $this->engine()->SetSubject($pdfParams['subject']);
     $this->engine()->SetKeywords($pdfParams['keywords']);
     Configure::write('debug', false);
     $this->engine()->AddPage();
     $this->engine()->writeHTML($content, true, 0, true, 0);
     $filename = isset($pdfParams['filename']) ? $pdfParams['filename'] : 'document.pdf';
     $output = isset($pdfParams['output']) ? $pdfParams['output'] : 'S';
     switch (strtoupper($output)) {
         case "D":
             // force download
             return $this->engine()->Output($filename, 'D');
         case "I":
             // send to browser
             return $this->engine()->Output('', 'I');
         case "F":
             // save to disk
             return $this->engine()->Output(TMP . $filename, 'F');
         case "FD":
             // save to disk and force download
             return $this->engine()->Output(TMP . $filename, 'FD');
         case "S":
         default:
             // send as application/pdf response
             $this->response->type('pdf');
             $this->response->header('Content-Disposition: inline; filename="' . $filename . '"');
             return $this->engine()->Output('', 'S');
     }
 }
예제 #25
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Plugin::load('TestPlugin');
     Configure::write('App.namespace', 'TestApp');
     $this->dispatcher = $this->getMockBuilder('Cake\\Console\\ShellDispatcher')->setMethods(['_stop'])->getMock();
 }
 /**
  * @return void
  */
 public function setUp()
 {
     Configure::write('Roles', ['user' => 1, 'moderator' => 2, 'admin' => 3]);
     $this->config = ['filePath' => Plugin::path('TinyAuth') . 'tests' . DS . 'test_files' . DS, 'autoClearCache' => true];
     $this->View = new View();
     $this->AuthUserHelper = new AuthUserHelper($this->View, $this->config);
 }
예제 #27
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->Table = TableRegistry::get('Articles');
     $this->FilterRegistry = new FilterRegistry($this->Table);
     Configure::write('App.namespace', 'TestApp');
 }
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('Highlighter', ['debug' => false]);
     $this->request = $this->getMock('Cake\\Network\\Request', []);
     $this->view = new View($this->request);
     $this->Highlighter = new HighlighterHelper($this->view);
 }
 /**
  * Setup Defaults
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->QueueShell = new TestQueueShell();
     $this->QueueShell->initialize();
     $this->QueueShell->loadTasks();
     Configure::write('Queue', ['sleeptime' => 2, 'gcprob' => 10, 'defaultworkertimeout' => 3, 'defaultworkerretries' => 1, 'workermaxruntime' => 5, 'cleanuptimeout' => 10, 'exitwhennothingtodo' => false, 'pidfilepath' => TMP . 'queue' . DS, 'log' => false]);
 }
 /**
  * setUp
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('Geocoder', ['locale' => 'DE']);
     $this->Addresses = TableRegistry::get('Geo.Addresses');
     $this->Addresses->addBehavior('Geocoder');
     $this->db = ConnectionManager::get('test');
 }