Skip to content

Commit bed4bd4

Browse files
committed
Better work with unknown action
1 parent da8fc4a commit bed4bd4

File tree

3 files changed

+10
-68
lines changed

3 files changed

+10
-68
lines changed

build.xml

Lines changed: 0 additions & 59 deletions
This file was deleted.

src/AbraFlexi/RW.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -335,17 +335,17 @@ public function controlReadOnlyColumns($data = null) {
335335

336336
/**
337337
* Convert Timestamp to AbraFlexi Date format.
338+
*
339+
* @deprecated since version 2.19 - please use \AbraFlexi\Date() object instead
338340
*
339341
* @param int $timpestamp
340342
*
341-
* @return string AbraFlexi Date or NULL
343+
* @return AbraFlexi\ Date or NULL
342344
*/
343345
public static function timestampToFlexiDate($timpestamp = null) {
344-
$flexiDate = null;
346+
$flexiDate = new Date();
345347
if (!is_null($timpestamp)) {
346-
$date = new \DateTime();
347-
$date->setTimestamp($timpestamp);
348-
$flexiDate = $date->format('Y-m-d');
348+
$flexiDate->setTimestamp($timpestamp);
349349
}
350350
return $flexiDate;
351351
}
@@ -548,9 +548,10 @@ public function performAction(string $action, $method = 'int') {
548548
'GET');
549549
break;
550550
}
551-
} else {
552-
throw new \Exception(sprintf(_('Unsupported action %s for evidence %s'),
553-
$action, $this->getEvidence()));
551+
} else if ($this->throwException === true) {
552+
$this->lastResponseCode = 404;
553+
throw new Exception(sprintf(_('Unsupported action "%s" for evidence "%s"'),
554+
$action, $this->getEvidence()), $this);
554555
}
555556

556557
return $result;

testing/src/AbraFlexi/RWTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected function tearDown(): void {
8282

8383
/**
8484
* @covers AbraFlexi\AbraFlexiRW::performAction
85-
* @expectedException \Exception
85+
* @expectedException \AbraFlexi\Exception
8686
*/
8787
public function testPerformAction() {
8888
$actions = $this->object->getActionsInfo();

0 commit comments

Comments
 (0)