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


PHP Object::execute方法代码示例

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


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

示例1: test_basic

 /**
  * Test basic usage of the command tester
  *
  * @return void
  * @author Dan Cox
  */
 public function test_basic()
 {
     $this->CT->execute('utility:main');
     $this->assertContains('The main action', $this->CT->getOutput());
     $this->assertInstanceOf('\\Danzabar\\CLI\\Application', $this->CT->getApplication());
     $this->assertInstanceOf('\\UtilityTask', $this->CT->getTask());
 }
开发者ID:danzabar,项目名称:phalcon-cli,代码行数:13,代码来源:CommandTesterTest.php

示例2: query

 /**
  * Executes an SQL statement
  * @param type $sql SQL query to execute
  * @param type $params params for the query
  */
 public function query($sql, $params = null)
 {
     if (isset($this->cfg->prefix)) {
         $sql = str_replace('#__', $this->cfg->prefix, $sql);
     }
     $this->stmt = $this->instance->prepare($sql);
     $this->stmt->execute($params);
     $this->checkQuery();
 }
开发者ID:walney,项目名称:SlaveFramework,代码行数:14,代码来源:Database.php

示例3: test_helpFormat

 /**
  * Test the help list format is correct
  *
  * @return void
  * @author Dan Cox
  */
 public function test_helpFormat()
 {
     $this->CT->execute();
     // Application Detail Assertions
     $this->assertContains('Test CLI', $this->CT->getOutput());
     $this->assertContains('version 1.0.0', $this->CT->getOutput());
     // Random detail assertions
     $this->assertContains('Help', $this->CT->getOutput());
     $this->assertContains('Fake', $this->CT->getOutput());
     $this->assertContains('confirmation', $this->CT->getOutput());
     // Instruction Assertions
     $this->assertContains('php [file] [command] [arguments] [options]', $this->CT->getOutput());
     // Example commands Assertions
     $this->assertContains('php [file] fake [params]', $this->CT->getOutput());
     $this->assertContains('php [file] fake:askMe [params]', $this->CT->getOutput());
 }
开发者ID:danzabar,项目名称:phalcon-cli,代码行数:22,代码来源:HelpTaskTest.php

示例4: process

 /**
  * Exectutes a statement and calls the get_result method.
  *
  * @param Object $stmt : MySQLI query to be executed
  **/
 function process($stmt)
 {
     if (!$stmt->execute()) {
         echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
     }
     return $this->get_result($stmt);
 }
开发者ID:ChromeTemplar,项目名称:nhlakes_unhm,代码行数:12,代码来源:applicationModel.php

示例5: test_table

 /**
  * Test the table drawing functionality.
  *
  * @return void
  * @author Dan Cox
  */
 public function test_table()
 {
     $this->CT->execute('utility:table');
     $this->assertContains('Header1', $this->CT->getOutput());
     $this->assertContains('Header2', $this->CT->getOutput());
 }
开发者ID:danzabar,项目名称:phalcon-cli,代码行数:12,代码来源:TableTest.php

示例6: test_acceptedExplicitConfirmation

 /**
  * Test the acceptance of the explicit confirmation
  *
  * @return void
  * @author Dan Cox
  */
 public function test_acceptedExplicitConfirmation()
 {
     $this->CT->setInput("yes\n");
     $this->CT->execute('fake:explicitConfirm');
     $this->assertContains("Confirmed", $this->CT->getOutput());
 }
开发者ID:danzabar,项目名称:phalcon-cli,代码行数:12,代码来源:ConfirmationTest.php

示例7: import

 /**
  * Store uploaded file to cache folder,
  * fully manage error messages and ask for database insert
  * 
  * @access public
  * @return boolean 
  */
 public function import()
 {
     // Get file info
     $file = $this->app->input->files->get('datasourceimport');
     $tmpFile = $file['tmp_name'];
     $tmpFileName = $file['name'];
     try {
         if (!$tmpFile || !$tmpFileName) {
             throw new JMapException(JText::_('COM_JMAP_NOFILE_SELECTED'), 'error');
         }
         $tmpFileSize = $file['size'];
         $allowedFileSize = 2 * 1024 * 1024;
         // MB->Bytes
         if ($tmpFileSize > $allowedFileSize) {
             throw new JMapException(JText::_('COM_JMAP_SIZE_ERROR') . ' Max 2MB.', 'error');
         }
         $tmpFileExtension = @array_pop(explode('.', $tmpFileName));
         if ($tmpFileExtension != 'json') {
             throw new JMapException(JText::_('COM_JMAP_EXT_ERROR'), 'error');
         }
         // Deserialize contents
         $fileContents = file_get_contents($tmpFile);
         if ($fileContents) {
             $objectToRestore = json_decode($fileContents);
         }
         if (!is_array($objectToRestore)) {
             throw new JMapException(JText::_('COM_JMAP_INVALID_IMPORT_DATA'), 'error');
         }
         // Prepare the values array
         $dbQueryArray = array();
         foreach ($objectToRestore as $dataSource) {
             // Check if the data source is of type plugin and if the plugin is installed, otherwise skip and warn user
             if ($dataSource->type == 'plugin' && !JFolder::exists(JPATH_COMPONENT_ADMINISTRATOR . '/plugins/' . strtolower($dataSource->name))) {
                 $this->app->enqueueMessage(JText::sprintf('COM_JMAP_NOPLUGIN_INSTALLED_IMPORTED_DATASOURCE', $dataSource->name));
                 continue;
             }
             $dbSourceArray = array();
             $dbSourceArray[] = $this->dbo->quote($dataSource->type);
             $dbSourceArray[] = $this->dbo->quote(strip_tags($dataSource->name));
             $dbSourceArray[] = $this->dbo->quote(strip_tags($dataSource->description));
             $dbSourceArray[] = (int) $dataSource->published;
             $dbSourceArray[] = $this->dbo->quote($dataSource->sqlquery);
             $dbSourceArray[] = $this->dbo->quote($dataSource->sqlquery_managed);
             $dbSourceArray[] = $this->dbo->quote($dataSource->params);
             // Source imploded assignment
             $dbQueryArray[] = implode(',', $dbSourceArray);
         }
         // Check if some valid data to import are available
         if (!count($dbQueryArray)) {
             throw new JMapException(JText::_('COM_JMAP_NO_IMPORT_DATA_FOUND'), 'warning');
         }
         // Final sources imploded assignment
         $implodedSources = '(' . implode('),(', $dbQueryArray) . ')';
         $queryImport = "INSERT INTO" . $this->dbo->quoteName('#__jmap') . "\n (" . "\n" . $this->dbo->quoteName('type') . "," . "\n" . $this->dbo->quoteName('name') . "," . "\n" . $this->dbo->quoteName('description') . "," . "\n" . $this->dbo->quoteName('published') . "," . "\n" . $this->dbo->quoteName('sqlquery') . "," . "\n" . $this->dbo->quoteName('sqlquery_managed') . "," . "\n" . $this->dbo->quoteName('params') . ")" . "\n VALUES " . $implodedSources;
         $this->dbo->setQuery($queryImport);
         $this->dbo->execute();
         if ($this->dbo->getErrorNum()) {
             throw new JMapException(JText::sprintf('COM_JMAP_DBERROR_IMPORT_DATA', $this->dbo->getErrorMsg()), 'error');
         }
     } catch (JMapException $e) {
         $this->setError($e);
         return false;
     } catch (Exception $e) {
         $jmapException = new JMapException($e->getMessage(), 'error');
         $this->setError($jmapException);
         return false;
     }
     return true;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:76,代码来源:sources.php

示例8: test_exceptionOnFalseMultipleChoiceAnswers

 /**
  * Test that an exception is thrown on a mulitple choice question
  *
  * @return void
  * @author Dan Cox
  */
 public function test_exceptionOnFalseMultipleChoiceAnswers()
 {
     $this->CT->setInput("answer, fake\n");
     $this->CT->execute("fake:multiChoice");
     $this->assertContains("The answer you selected is invalid", $this->CT->getOutput());
 }
开发者ID:danzabar,项目名称:phalcon-cli,代码行数:12,代码来源:QuestionTest.php

示例9: purge

 /**
  * Runs the purge method on loaded fixtures
  *
  * @return void
  * @author Dan Cox
  */
 public function purge()
 {
     $this->executor->execute($this->loader, new ChainFilter(), Executor::PURGE);
 }
开发者ID:antoligy,项目名称:Framework,代码行数:10,代码来源:FixtureManager.php

示例10: test_intOptionFail

 /**
  * Same as above but a fail
  *
  * @return void
  * @author Dan Cox
  */
 public function test_intOptionFail()
 {
     $this->setExpectedException('Danzabar\\CLI\\Input\\Exceptions\\ValidationFailException');
     $this->CT->execute('Input:intTest', array('int' => 'skjkd'));
 }
开发者ID:danzabar,项目名称:phalcon-cli,代码行数:11,代码来源:InputTaskTest.php


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