Fix tests

This commit is contained in:
Nicolas Le Goff
2014-11-19 12:39:42 +01:00
parent 7d44a356e3
commit 2000f4116f
4 changed files with 15 additions and 11 deletions

View File

@@ -672,6 +672,8 @@ class databox extends base
*/ */
public function get_meta_structure() public function get_meta_structure()
{ {
$metaStructData = array();
if ($this->meta_struct) { if ($this->meta_struct) {
return $this->meta_struct; return $this->meta_struct;
} }
@@ -685,13 +687,15 @@ class databox extends base
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
$metaStructData = $rs; if ($rs) {
$this->set_data_to_cache($metaStructData, self::CACHE_META_STRUCT); $metaStructData = $rs;
$this->set_data_to_cache($metaStructData, self::CACHE_META_STRUCT);
}
} }
$this->meta_struct = new databox_descriptionStructure(); $this->meta_struct = new databox_descriptionStructure();
foreach ($metaStructData as $row) { foreach ((array) $metaStructData as $row) {
$this->meta_struct->add_element(databox_field::get_instance($this->app, $this, $row['id'])); $this->meta_struct->add_element(databox_field::get_instance($this->app, $this, $row['id']));
} }

View File

@@ -466,7 +466,7 @@ class module_report_activity extends module_report
//set title //set title
$this->title = _('report:: Detail des telechargements'); $this->title = _('report:: Detail des telechargements');
$this->setDateField('log_search.date'); $this->setDateField('log_docs.date');
$sqlBuilder = new module_report_sql($this->app, $this); $sqlBuilder = new module_report_sql($this->app, $this);
$filter = $sqlBuilder->getFilters()->getReportFilter(); $filter = $sqlBuilder->getFilters()->getReportFilter();
$params = array_merge(array(), $filter['params']); $params = array_merge(array(), $filter['params']);
@@ -602,7 +602,7 @@ class module_report_activity extends module_report
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']); $params = array(':site_id' => $app['phraseanet.configuration']['main']['key']);
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax, 'log_search.date'); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax, 'log_docs.date');
$params = array_merge($params, $datefilter['params']); $params = array_merge($params, $datefilter['params']);
/* /*
$sql = "SELECT tt.usrid, tt.user, tt.final, tt.record_id, SUM(1) AS nb, SUM(size) AS poid $sql = "SELECT tt.usrid, tt.user, tt.final, tt.record_id, SUM(1) AS nb, SUM(size) AS poid
@@ -623,11 +623,11 @@ class module_report_activity extends module_report
*/ */
$sql = "SELECT tt.usrid, tt.user, tt.final, tt.record_id, SUM(1) AS nb, SUM(size) AS poid\n" $sql = "SELECT tt.usrid, tt.user, tt.final, tt.record_id, SUM(1) AS nb, SUM(size) AS poid\n"
. " FROM (\n" . " FROM (\n"
. " SELECT DISTINCT(log.id), log.usrid, user, final, log_date.record_id\n" . " SELECT DISTINCT(log.id), log.usrid, user, final, log_docs.record_id\n"
. " FROM (log_docs AS log_date)\n" . " FROM (log_docs)\n"
. " INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_date.log_id)\n" . " INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_docs.log_id)\n"
. " WHERE log.site = :site_id\n" . " WHERE log.site = :site_id\n"
. " AND log_date.action = 'download'\n" . " AND log_docs.action = 'download'\n"
. " AND (" . $datefilter['sql'] . ")\n" . " AND (" . $datefilter['sql'] . ")\n"
. ") AS tt\n" . ") AS tt\n"
. "LEFT JOIN subdef AS s ON (s.record_id = tt.record_id)\n" . "LEFT JOIN subdef AS s ON (s.record_id = tt.record_id)\n"

View File

@@ -523,6 +523,8 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/ */
public function testPostEmptyCollectionWithHighRecordAmount() public function testPostEmptyCollectionWithHighRecordAmount()
{ {
$this->markTestSkipped('This tests lasts for 40 sec.');
$this->setAdmin(true); $this->setAdmin(true);
$collection = $this->createOneCollection(); $collection = $this->createOneCollection();

View File

@@ -34,7 +34,6 @@ class editTest extends PhraseanetPHPUnitAuthenticatedAbstract
'record_id' => array("", 1, 1, 1, 1), 'record_id' => array("", 1, 1, 1, 1),
'file' => array("", 1, 0, 1, 1), 'file' => array("", 1, 0, 1, 1),
'mime' => array("", 1, 0, 1, 1), 'mime' => array("", 1, 0, 1, 1),
'size' => array("", 1, 0, 1, 1)
); );
foreach ($this->ret as $sbasid => $collections) { foreach ($this->ret as $sbasid => $collections) {
@@ -160,7 +159,6 @@ class editTest extends PhraseanetPHPUnitAuthenticatedAbstract
if (! $groupby) { if (! $groupby) {
foreach ($report['result'] as $row) { foreach ($report['result'] as $row) {
foreach ($conf as $key => $value) { foreach ($conf as $key => $value) {
$this->assertArrayHasKey($key, $row); $this->assertArrayHasKey($key, $row);
$condition = is_string($row[$key]) || is_int($row[$key]); $condition = is_string($row[$key]) || is_int($row[$key]);
$this->assertTrue($condition); $this->assertTrue($condition);