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


PHP DatabaseConnection::expects方法代码示例

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


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

示例1: truncate_multiple_tables_when_configured

 /**
  * @test
  */
 public function truncate_multiple_tables_when_configured()
 {
     $configuration = ['truncate' => ['test', 'test2', 'test3']];
     $processor = $this->getMockBuilder(Configuration::class)->disableOriginalConstructor()->getMock();
     $this->connection->expects($this->exactly(3))->method('exec_TRUNCATEquery')->withConsecutive(['test'], ['test2'], ['test3']);
     $this->fixture->execute($processor, $configuration);
 }
开发者ID:sirdiego,项目名称:importr,代码行数:10,代码来源:TruncateTableTest.php

示例2: setUp

 /**
  * Set up
  *
  * @return void
  */
 protected function setUp()
 {
     $this->database = $this->getMock(DatabaseConnection::class, array('exec_SELECTgetSingleRow'));
     $this->database->expects($this->any())->method('exec_SELECTgetSingleRow')->will($this->returnValue(array('uid' => 0, 'parent' => '')));
     $this->treeData = new TreeNode();
     $GLOBALS['TYPO3_DB'] = $this->database;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:12,代码来源:DatabaseTreeDataProviderTest.php

示例3: databaseResultIsUsedWhenNoCachedResultIsPresent

 /**
  * @test
  */
 public function databaseResultIsUsedWhenNoCachedResultIsPresent()
 {
     $fakeConfiguration = array('select.' => array('checkRootPageId' => true, 'checkLanguage' => true, 'SELECT' => '', 'FROM' => '', 'ADD_WHERE' => '', 'GROUP_BY' => '', 'ORDER_BY' => ''), 'limit');
     $this->configurationMock->expects($this->once())->method('getSearchFrequentSearchesConfiguration')->will($this->returnValue($fakeConfiguration));
     $this->databaseMock->expects($this->once())->method('exec_SELECTgetRows')->will($this->returnValue(array(array('search_term' => 'my search', 'hits' => 22))));
     //we fake that we have no frequent searches in the cache and therefore expect that the database will be queried
     $this->fakeIdentifierNotInCache();
     $frequentTerms = $this->frequentSearchesService->getFrequentSearchTerms();
     $this->assertSame($frequentTerms, array('my search' => 22), 'Could not retrieve frequent search terms');
 }
开发者ID:sitegeist,项目名称:ext-solr,代码行数:13,代码来源:FrequentSearchesServiceTest.php

示例4: parametersAreReplacedInQueryWhenBoundWithBindValues

 /**
  * Checking if parameters bound to the statement by bindValues()
  * are properly replaced in the query.
  *
  * @test
  * @dataProvider parametersAndQueriesDataProvider
  * @param string $query Query with unreplaced markers
  * @param array  $parameters Array of parameters to be replaced in the query
  * @param string $expectedResult Query with all markers replaced
  * @return void
  */
 public function parametersAreReplacedInQueryWhenBoundWithBindValues($query, $parameters, $expectedResult)
 {
     $statement = $this->createPreparedStatement($query);
     $this->databaseStub->expects($this->any())->method('prepare_PREPAREDquery')->with($this->equalTo($expectedResult));
     $statement->bindValues($parameters);
     $statement->execute();
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:18,代码来源:PreparedStatementTest.php

示例5: deleteMethodCallsExpectedDatabaseMethodWithRecord

 /**
  * @test
  */
 public function deleteMethodCallsExpectedDatabaseMethodWithRecord()
 {
     $table = 'test';
     $uid = 123;
     $record = array('uid' => 123);
     $mock = $this->getMockServiceInstance(array(), array('exec_DELETEquery'));
     self::$connectionMock->expects($this->once())->method('exec_DELETEquery')->with($table, "uid = '" . $uid . "'");
     $mock->delete($table, $record);
 }
开发者ID:neufeind,项目名称:flux,代码行数:12,代码来源:RecordServiceTest.php

示例6: updateQueryCreateValidQuery

 /**
  * @test
  *
  * @return void
  */
 public function updateQueryCreateValidQuery()
 {
     $this->subject = $this->getAccessibleMock(DatabaseConnection::class, ['fullQuoteStr'], [], '', false);
     $this->subject->expects($this->any())->method('fullQuoteStr')->will($this->returnCallback(function ($data) {
         return '\'' . (string) $data . '\'';
     }));
     $fieldsValues = [$this->testField => 'aTestValue'];
     $queryExpected = "UPDATE {$this->testTable} SET {$this->testField}='aTestValue' WHERE id=1";
     $queryGenerated = $this->subject->UPDATEquery($this->testTable, 'id=1', $fieldsValues);
     $this->assertSame($queryExpected, $queryGenerated);
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:16,代码来源:DatabaseConnectionTest.php

示例7: doesFindByTypeAndTableNameReturnObjects

 /**
  * @test
  */
 public function doesFindByTypeAndTableNameReturnObjects()
 {
     $testUid = rand(1, 1000);
     $testTable = uniqid('sys_collection_');
     $type = \TYPO3\CMS\Core\Collection\RecordCollectionRepository::TYPE_Static;
     $this->databaseMock->expects($this->once())->method('exec_SELECTgetRows')->will($this->returnCallback(array($this, 'getRowsCallback')));
     $this->getRowsCallbackReturnValue = array(array('uid' => $testUid, 'type' => $type, 'table_name' => $this->testTableName), array('uid' => $testUid, 'type' => $type, 'table_name' => $this->testTableName));
     $objects = $this->fixture->findByTypeAndTableName($type, $testTable);
     $this->assertEquals(2, count($objects));
     $this->assertInstanceOf('TYPO3\\CMS\\Core\\Collection\\StaticRecordCollection', $objects[0]);
     $this->assertInstanceOf('TYPO3\\CMS\\Core\\Collection\\StaticRecordCollection', $objects[1]);
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:15,代码来源:RecordCollectionRepositoryTest.php

示例8: inputValueCheckDoesNotCallGetDateTimeFormatsForNonDatetimeFields

 /**
  * @test
  * @param array $tcaFieldConf
  * @dataProvider inputValueCheckDoesNotCallGetDateTimeFormatsForNonDatetimeFieldsDataProvider
  */
 public function inputValueCheckDoesNotCallGetDateTimeFormatsForNonDatetimeFields($tcaFieldConf)
 {
     $this->mockDatabaseConnection->expects($this->never())->method('getDateTimeFormats');
     $this->subject->checkValue_input(array(), '', $tcaFieldConf, array());
 }
开发者ID:rob-ot-dot-be,项目名称:ggallkeysecurity,代码行数:10,代码来源:DataHandlerTest.php

示例9: assertDatabaseWillNeverBeQueried

 /**
  * @return void
  */
 protected function assertDatabaseWillNeverBeQueried()
 {
     $this->databaseMock->expects($this->never())->method('exec_SELECTgetRows');
 }
开发者ID:sitegeist,项目名称:ext-solr,代码行数:7,代码来源:LastSearchesServiceTest.php


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