PHP Classes

File: tests/QuoteTest.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   EasyDB   tests/QuoteTest.php   Download  
File: tests/QuoteTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: EasyDB
Simple Database Abstraction Layer around PDO
Author: By
Last change: manually changing to squish "method name is not in camel caps format" style error
single-lining test classes after composer run fix-style
running composer run fix-style
Date: 6 years ago
Size: 1,256 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);

namespace
ParagonIE\EasyDB\Tests;

/**
 * Class ExecTest
 * @package ParagonIE\EasyDB\Tests
 */
class QuoteTest extends EasyDBTest
{

   
/**
     * @dataProvider goodFactoryCreateArgument2EasyDBQuoteProvider
     * @depends ParagonIE\EasyDB\Tests\EscapeIdentifierTest::testEscapeIdentifier
     * @depends ParagonIE\EasyDB\Tests\EscapeIdentifierTest::testEscapeIdentifierThrowsSomething
     * @param callable $cb
     * @param $quoteThis
     * @param array $expectOneOfThese
     */
   
public function testQuote(callable $cb, $quoteThis, array $expectOneOfThese)
    {
       
$db = $this->easyDBExpectedFromCallable($cb);

       
$this->assertTrue(count($expectOneOfThese) > 0);

       
$matchedOneOfThose = false;
       
$quoted = $db->quote((string)$quoteThis);

        foreach (
$expectOneOfThese as $expectThis) {
            if (
$quoted === $expectThis) {
               
$this->assertSame($quoted, $expectThis);
               
$matchedOneOfThose = true;
            }
        }
        if (!
$matchedOneOfThose) {
           
$this->assertTrue(
               
false,
               
'Did not match ' . $quoted . ' against any of ' . implode('; ', $expectOneOfThese)
            );
        }
    }
}