コード例 #1
0
ファイル: MysqliDBTest.php プロジェクト: method-es/php-common
 public function testDBQueryFailure()
 {
     $this->setExpectedException('Exception');
     $dbConfig = new DBConfig('tests/data/MysqliDBTest1.json');
     $example = new MysqliDB($dbConfig);
     $query = "SELECT * FROM `not_a_real_table`";
     $result = $example->Query($query);
 }
コード例 #2
0
ファイル: test.php プロジェクト: method-es/php-common
<?php

use Method\Common\Config\DBConfig;
use Method\Common\DB\MysqliDB;
require_once 'vendor/autoload.php';
$dbConfig = new DBConfig('tests/data/MysqliDBTest1.json');
$example = new MysqliDB($dbConfig);
/* @var mysqli $db */
//$db = $example->getMysqli();
$query = "SELECT * FROM `test`";
$result = $example->Query($query);
//$result = $db->query($query);
//$res = $result->getResult();
//$res->free();
//$result = $example->Query($query);
//$result->free();
//this file's sole purpose is to test all things within; comment or uncomment that which you don't want to test...
// use Method\Common\Cache\Cache;
// function TestCache(){
//     // to test the cache we should do a few things
//     // 1. a. Loading the cache that we know doesn't exist
//     //    b. Loading the cache that we know does exist
//     //
//     // 2. a. Access data we know is not there
//     //    b. Access data we know is there
//     //
//     // 3. Check the remove works
//     // 4. Check the clear works
//     $cacheOne = new Cache("cacheOne",false,false,false,10);
//     $cacheTwo = new Cache("cacheTwo");
//     $cacheOneFile = $cacheOne->GetCacheLocation();