Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
k-samuel committed Feb 11, 2021
2 parents fc3d586 + 17a6c9e commit 00f24ef
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 36 deletions.
2 changes: 1 addition & 1 deletion application/configs/common/dist/versions.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
return array(
'core'=>'3.1.0',
'core'=>'3.2.0',
);
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dvelum/dvelum-core",
"version": "3.1.0",
"version": "3.2.0",
"type": "project",
"description": "DVelum 3.x core",
"keywords": ["dvelum","php"],
Expand Down
51 changes: 21 additions & 30 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<phpunit bootstrap="tests/unit/bootstrap.php"
colors="true"
convertErrorsToExceptions="false"
convertNoticesToExceptions="false"
convertWarningsToExceptions="false"
backupGlobals="false"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false">
<testsuite name="Main Test Suite">
<directory>./tests/unit/</directory>
</testsuite>
<filter>
<whitelist>
<directory suffix=".php">./application/classes</directory>
<directory suffix=".php">./src</directory>
<exclude>
<directory suffix=".phtml">./</directory>
<file>./bootstrap.php</file>
<file>./console.php</file>
<file>./console_client.php</file>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="./data/phpunit_report" lowUpperBound="35" highLowerBound="70"/>
</logging>
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/unit/bootstrap.php" colors="true" convertErrorsToExceptions="false" convertNoticesToExceptions="false" convertWarningsToExceptions="false" backupGlobals="false" processIsolation="false" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">./application/classes</directory>
<directory suffix=".php">./src</directory>
</include>
<exclude>
<directory suffix=".phtml">./</directory>
<file>./bootstrap.php</file>
<file>./console.php</file>
<file>./console_client.php</file>
</exclude>
<report>
<html outputDirectory="./data/phpunit_report" lowUpperBound="35" highLowerBound="70"/>
</report>
</coverage>
<testsuite name="Main Test Suite">
<directory>./tests/unit/</directory>
</testsuite>
<logging/>
</phpunit>
2 changes: 2 additions & 0 deletions src/Dvelum/Db/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ public function update(int $recordId, array $data, string $keyField = 'id'): boo
* @param int $recordId
* @param string $keyField
* @return array
* @throws \Exception
*/
public function getItem(int $recordId, string $keyField = 'id'): array
{
Expand Down Expand Up @@ -222,6 +223,7 @@ public function getLogsAdapter(): ?LogInterface
* @param int $lifetime
* @param string $keyField
* @return array
* @throws \Exception
*/
public function getCachedItem(int $recordId, int $lifetime, string $keyField = 'id'): array
{
Expand Down
13 changes: 9 additions & 4 deletions src/Dvelum/Db/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,34 +293,37 @@ public function __toString(): string
/**
* Fetch all records
* @return array
* @throws \Exception
*/
public function fetchAll(): array
{
try {
return $this->db->fetchAll($this->__toString());
} catch (\Exception $e) {
$this->model->logError($e->getMessage());
return [];
throw $e;
}
}

/**
* Fetch one
* @return mixed
* @throws \Exception
*/
public function fetchOne()
{
try {
return $this->db->fetchOne($this->__toString());
} catch (\Exception $e) {
$this->model->logError($e->getMessage());
return null;
throw $e;
}
}

/**
* Fetch first result row
* @return array
* @throws \Exception
*/
public function fetchRow(): array
{
Expand All @@ -332,27 +335,29 @@ public function fetchRow(): array
return $result;
} catch (\Exception $e) {
$this->model->logError($e->getMessage());
return [];
throw $e;
}
}

/**
* Fetch column
* @return array
* @throws \Exception
*/
public function fetchCol(): array
{
try {
return $this->db->fetchCol($this->__toString());
} catch (\Exception $e) {
$this->model->logError($e->getMessage());
return [];
throw $e;
}
}

/**
* Count the number of rows that satisfy the filters
* @return int
* @throws \Exception
*/
public function getCount(): int
{
Expand Down

0 comments on commit 00f24ef

Please sign in to comment.