diff --git a/Controller/ApiController.php b/Controller/ApiController.php index bfac342..31a227e 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -73,7 +73,7 @@ final class ApiController extends Controller } // Using empty string as the data is represented by the current model - $newString = ''; //StringUtils::stringify($new, \JSON_PRETTY_PRINT); + $newString = null; //StringUtils::stringify($new, \JSON_PRETTY_PRINT); $audit = new Audit( new NullAccount($account), null, diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index 0aa3a23..264cba6 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -95,7 +95,10 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase public function testLogCreate() : void { $this->module->eventLogCreate(1, null, ['id' => 1, 'test' => true], 1, 'test-trigger', 'Auditor', 'abc', 'def'); - $logs = AuditMapper::getAll()->execute(); + $logs = AuditMapper::getAll() + ->sort('id', 'DESC') + ->limit(100) + ->execute(); foreach($logs as $log) { if ($log->id > 0 @@ -105,7 +108,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase && $log->ref === 'abc' && \strlen($log->content) > 0 && $log->old === null - && \strlen($log->new) > 0 + && $log->new === null // null because the object itself is the data, no additional logging required ) { self::assertTrue(true); return;