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


PHP PHPUnit_Framework_MockObject_MockObject::SELECTquery方法代码示例

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


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

示例1: multipleExpressiosInWhereClauseAreBracedCorrectly

 /**
  * @test
  */
 public function multipleExpressiosInWhereClauseAreBracedCorrectly()
 {
     $listMaxExpressions = 1000;
     $mockSpecificsOci8 = $this->getAccessibleMock('TYPO3\\CMS\\Dbal\\Database\\Specifics\\Oci8', array(), array(), '', FALSE);
     $mockSpecificsOci8->expects($this->any())->method('getSpecific')->will($this->returnValue($listMaxExpressions));
     $INitems = range(0, 1250);
     $NOTINItems = range(0, 1001);
     $where = 'uid = 1981 AND uid IN(' . implode(',', $INitems) . ') OR uid = 42 AND uid NOT IN(' . implode(',', $NOTINItems) . ')';
     $result = $this->subject->SELECTquery('uid, pid', 'tt_content', $where);
     $chunks = array_chunk($INitems, $listMaxExpressions);
     $INItemsWhereExpr = array();
     foreach ($chunks as $chunk) {
         $INItemsWhereExpr[] = '"uid" IN (' . implode(',', $chunk) . ')';
     }
     $chunks = array_chunk($NOTINItems, $listMaxExpressions);
     $NOTINItemsWhereExpr = array();
     foreach ($chunks as $chunk) {
         $NOTINItemsWhereExpr[] = '"uid" NOT IN (' . implode(',', $chunk) . ')';
     }
     /**
      * $expectedWhere:
      * "uid" = 1981 AND (
      *        "uid" IN (1,2,3,4,...,1000)
      *     OR "uid" IN (1001,1002,...,1250)
      * ) OR "uid" = 42 AND (
      *        "uid" NOT IN (1,2,3,4,...,1000)
      *    AND "uid" NOT IN (1001)
      * )
      */
     $expectedWhere = '"uid" = 1981 AND (' . implode(' OR ', $INItemsWhereExpr) . ') OR "uid" = 42 AND (' . implode(' AND ', $NOTINItemsWhereExpr) . ')';
     $expectedQuery = 'SELECT "uid", "pid" FROM "tt_content" WHERE ' . $expectedWhere;
     $this->assertEquals($expectedQuery, $this->cleanSql($result));
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:36,代码来源:DatabaseConnectionOracleTest.php

示例2: notLikeBinaryOperatorIsKept

 /**
  * @test
  * @see http://forge.typo3.org/issues/21514
  */
 public function notLikeBinaryOperatorIsKept()
 {
     $result = $this->cleanSql($this->subject->SELECTquery('*', 'tt_content', 'bodytext NOT LIKE BINARY \'test\''));
     $expected = 'SELECT * FROM tt_content WHERE bodytext NOT LIKE BINARY \'test\'';
     $this->assertEquals($expected, $this->cleanSql($result));
 }
开发者ID:KarlDennisMatthaei1923,项目名称:PierraaDesign,代码行数:10,代码来源:DatabaseConnectionTest.php

示例3: notEqualAnsiOperatorCanBeParsed

 /**
  * @test
  * @see http://forge.typo3.org/issues/32626
  */
 public function notEqualAnsiOperatorCanBeParsed()
 {
     $result = $this->subject->SELECTquery('*', 'pages', 'pid<>3');
     $expected = 'SELECT * FROM "pages" WHERE "pid" <> 3';
     $this->assertEquals($expected, $this->cleanSql($result));
 }
开发者ID:adrolli,项目名称:TYPO3.CMS,代码行数:10,代码来源:DatabaseConnectionPostgresqlTest.php

示例4: someCountFieldsInOrderByAreNotInGroupBy

 /**
  * @test
  * @see http://forge.typo3.org/issues/43262
  */
 public function someCountFieldsInOrderByAreNotInGroupBy()
 {
     $result = $this->subject->SELECTquery('COUNT(title), COUNT(pid)', 'pages', '', 'title', 'title, pid');
     $expected = 'SELECT COUNT("title"), COUNT("pid") FROM "pages" GROUP BY "title" ORDER BY "title"';
     $this->assertEquals($expected, $this->cleanSql($result));
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:10,代码来源:DatabaseConnectionPostgresqlTest.php

示例5: singleQuotesAreProperlyEscaped

 /**
  * @test
  * @see http://forge.typo3.org/issues/27760
  */
 public function singleQuotesAreProperlyEscaped()
 {
     $result = $this->subject->SELECTquery('ISEC.phash', 'index_section ISEC, index_fulltext IFT', 'IFT.fulltextdata LIKE \'%' . $this->subject->quoteStr("Don't worry", 'index_fulltext') . '%\' AND ISEC.phash = IFT.phash', 'ISEC.phash');
     $expected = 'SELECT "ISEC"."phash" FROM "index_section" "ISEC", "index_fulltext" "IFT" WHERE "IFT"."fulltextdata" LIKE \'%Don\'\'t worry%\' AND "ISEC"."phash" = "IFT"."phash" GROUP BY "ISEC"."phash"';
     $this->assertEquals($expected, $this->cleanSql($result));
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:10,代码来源:DatabaseConnectionMssqlTest.php

示例6: likeBinaryOperatorIsRemoved

 /**
  * @test
  * @see http://forge.typo3.org/issues/21514
  */
 public function likeBinaryOperatorIsRemoved()
 {
     $result = $this->subject->SELECTquery('*', 'tt_content', 'bodytext LIKE BINARY \'test\'');
     $expected = 'SELECT * FROM "tt_content" WHERE (dbms_lob.instr("bodytext", \'test\',1,1) > 0)';
     $this->assertEquals($expected, $this->cleanSql($result));
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:10,代码来源:DatabaseConnectionOracleTest.php

示例7: IfNullIsProperlyRemapped

 /**
  * @test
  * @see http://forge.typo3.org/issues/17552
  */
 public function IfNullIsProperlyRemapped()
 {
     $result = $this->subject->SELECTquery('*', 'tt_news_cat_mm', 'IFNULL(tt_news_cat_mm.uid_foreign,0) IN (21,22)');
     $expected = 'SELECT * FROM "tt_news_cat_mm" WHERE ISNULL("tt_news_cat_mm"."uid_foreign", 0) IN (21,22)';
     $this->assertEquals($expected, $this->cleanSql($result));
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:10,代码来源:DatabaseConnectionMssqlTest.php


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