public function testFindAllOfMonth() { $LOCALogName = "forFindLOCALog"; $LOCALogName2 = "forFindLOCALog2"; $loca = getLOCALogInstance($LOCALogName); $loca->datetime = '2014-06-01'; $loca2 = getLOCALogInstance($LOCALogName2); $loca2->datetime = '2014-06-30'; $locas = array(); array_push($locas, $loca, $loca2); $bmapper = new LOCALogMapper(self::$pdo); $bmapper->insert($locas); $newLocas = $bmapper->findAllOfMonth(2014, 6, 'payment'); $this->assertEquals(2, count($newLocas)); }
<?php $rootPass = dirname(__FILE__) . '/../../'; require_once $rootPass . 'lib/db/dbfunctions.php'; require_once $rootPass . 'lib/db/Mapper/LOCALogMapper.php'; require_once $rootPass . 'lib/db/Model/LOCALog.php'; // $pdo = getPDO('test'); $pdo = getPDO($argv[4]); $lmapper = new LOCALogMapper($pdo); // $dbfacade = DBFacade::I($pdo); $result = $lmapper->findAllOfMonth((int) $argv[1], (int) $argv[2], $argv[3]); header("Content-Type: application/json; charset=utf-8"); echo json_encode($result);