Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Controller/RecognitionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
namespace OCA\Shillinq\Controller;

use OCA\Shillinq\AppInfo\Application;
use OCA\Shillinq\Recognition\RevenueRecognitionService;
use OCA\Shillinq\Service\RevenueRecognitionService;
use OCA\Shillinq\Service\AdministrationContextService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
Expand Down
2 changes: 1 addition & 1 deletion lib/Listener/OrderFulfilmentTransitionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
namespace OCA\Shillinq\Listener;

use OCA\OpenRegister\Event\ObjectTransitionedEvent;
use OCA\Shillinq\Integration\TenderNedStatusSync;
use OCA\Shillinq\Service\TenderNedStatusSync;
use OCA\Shillinq\Service\BudgetImpactEmitter;
use OCA\Shillinq\Service\ListenerSchemaResolver;
use OCP\EventDispatcher\Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* lib/Settings/shillinq_register.json.
*
* @category Lifecycle
* @package OCA\Shillinq\Consolidation
* @package OCA\Shillinq\Service
*
* @author Conduction Development Team <info@conduction.nl>
* @copyright 2026 Conduction B.V.
Expand All @@ -27,7 +27,7 @@

declare(strict_types=1);

namespace OCA\Shillinq\Consolidation;
namespace OCA\Shillinq\Service;

use OCA\Shillinq\AppInfo\Application;
use OCP\IAppConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* boundary.
*
* @category Service
* @package OCA\Shillinq\Recognition
* @package OCA\Shillinq\Service
*
* @author Conduction Development Team <info@conduction.nl>
* @copyright 2026 Conduction B.V.
Expand All @@ -40,7 +40,7 @@

declare(strict_types=1);

namespace OCA\Shillinq\Recognition;
namespace OCA\Shillinq\Service;

use OCA\Shillinq\AppInfo\Application;
use OCP\IAppConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
* KvK before the call is allowed (vendors cannot sync; only the
* aanbestedende dienst can — see design D6).
*
* @category Integration
* @package OCA\Shillinq\Integration
* @category Service
* @package OCA\Shillinq\Service
*
* @author Conduction Development Team <info@conduction.nl>
* @copyright 2026 Conduction B.V.
Expand All @@ -47,7 +47,7 @@

declare(strict_types=1);

namespace OCA\Shillinq\Integration;
namespace OCA\Shillinq\Service;

use OCA\Shillinq\AppInfo\Application;
use OCP\IAppConfig;
Expand Down
12 changes: 6 additions & 6 deletions lib/Settings/shillinq_register.json
Original file line number Diff line number Diff line change
Expand Up @@ -1994,14 +1994,14 @@
"to": "final",
"label": "Finalise balance sheet",
"description": "Operator or scheduled workflow closes fiscal period. Triggers balance-sheet aggregation (REQ-FS-004).",
"requires": "OCA\\Shillinq\\Consolidation\\ConsolidationGuard::requireFiscalPeriodClosed"
"requires": "OCA\\Shillinq\\Service\\ConsolidationGuard::requireFiscalPeriodClosed"
},
"publish": {
"from": "final",
"to": "published",
"label": "Publish balance sheet",
"description": "Operator (role: controller) releases to stakeholders via OR publication extension or ConsolidationGuard fallback per ADR-031.",
"requires": "OCA\\Shillinq\\Consolidation\\ConsolidationGuard::requirePublicationApproval"
"requires": "OCA\\Shillinq\\Service\\ConsolidationGuard::requirePublicationApproval"
},
"archive": {
"from": "published",
Expand Down Expand Up @@ -2212,14 +2212,14 @@
"to": "final",
"label": "Finalise trial balance",
"description": "Operator or scheduled workflow closes fiscal period. Also triggered by BalanceSheet finalise hook.",
"requires": "OCA\\Shillinq\\Consolidation\\ConsolidationGuard::requireFiscalPeriodClosed"
"requires": "OCA\\Shillinq\\Service\\ConsolidationGuard::requireFiscalPeriodClosed"
},
"publish": {
"from": "final",
"to": "published",
"label": "Publish trial balance",
"description": "Operator (role: controller) releases to stakeholders via OR publication extension or ConsolidationGuard fallback per ADR-031.",
"requires": "OCA\\Shillinq\\Consolidation\\ConsolidationGuard::requirePublicationApproval"
"requires": "OCA\\Shillinq\\Service\\ConsolidationGuard::requirePublicationApproval"
},
"archive": {
"from": "published",
Expand Down Expand Up @@ -2583,14 +2583,14 @@
"to": "final",
"label": "Finalise consolidated report",
"description": "Applies consolidation workflow and inter-company eliminations per ConsolidationGroup.eliminationRules. Consumed via OR consolidation extension (ADR-022) or ConsolidationGuard fallback per ADR-031 exception.",
"requires": "OCA\\Shillinq\\Consolidation\\ConsolidationGuard::requireAllMembersFinalised"
"requires": "OCA\\Shillinq\\Service\\ConsolidationGuard::requireAllMembersFinalised"
},
"publish": {
"from": "final",
"to": "published",
"label": "Publish consolidated report",
"description": "Operator (role: controller) releases to stakeholders via OR publication extension or ConsolidationGuard fallback per ADR-031.",
"requires": "OCA\\Shillinq\\Consolidation\\ConsolidationGuard::requirePublicationApproval"
"requires": "OCA\\Shillinq\\Service\\ConsolidationGuard::requirePublicationApproval"
},
"archive": {
"from": "published",
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Consolidation/ConsolidationGuardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

namespace OCA\Shillinq\Tests\Unit\Consolidation;

use OCA\Shillinq\Consolidation\ConsolidationGuard;
use OCA\Shillinq\Service\ConsolidationGuard;
use OCA\Shillinq\Tests\Unit\Service\Support\DuckObjectServiceAdapter;
use OCP\IAppConfig;
use PHPUnit\Framework\MockObject\MockObject;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Controller/RecognitionControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace OCA\Shillinq\Tests\Unit\Controller;

use OCA\Shillinq\Controller\RecognitionController;
use OCA\Shillinq\Recognition\RevenueRecognitionService;
use OCA\Shillinq\Service\RevenueRecognitionService;
use OCA\Shillinq\Service\AdministrationContextService;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Integration/TenderNedStatusSyncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

namespace OCA\Shillinq\Tests\Unit\Integration;

use OCA\Shillinq\Integration\TenderNedStatusSync;
use OCA\Shillinq\Service\TenderNedStatusSync;
use OCP\IAppConfig;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
Expand Down
83 changes: 82 additions & 1 deletion tests/Unit/Listener/OrderFulfilmentTransitionListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

use OCA\OpenRegister\Db\ObjectEntity;
use OCA\OpenRegister\Event\ObjectTransitionedEvent;
use OCA\Shillinq\Integration\TenderNedStatusSync;
use OCA\Shillinq\Service\TenderNedStatusSync;
use OCA\Shillinq\Listener\OrderFulfilmentTransitionListener;
use OCA\Shillinq\Service\BudgetImpactEmitter;
use OCA\Shillinq\Service\ListenerSchemaResolver;
Expand Down Expand Up @@ -108,7 +108,19 @@ private function spyingSync(): TenderNedStatusSync {
*/
public array $syncCalls = [];

/**
* When true, syncCompletion() throws — so a test can show the
* listener's fail-soft catch keeps the transition alive.
*
* @var bool
*/
public bool $throwOnSync = false;

public function syncCompletion(array $oplevering): bool {
if ($this->throwOnSync === true) {
throw new \RuntimeException('TenderNed is unreachable');
}

$this->syncCalls[] = $oplevering;
return true;
}//end syncCompletion()
Expand Down Expand Up @@ -344,6 +356,75 @@ public function testUnapprovedEindopleveringDoesNotTriggerSync(): void {
*
* @return void
*/
/**
* An event of another type is ignored. The dispatcher hands `Event`, so
* the instanceof guard is the only thing between this listener and a
* getTo() that does not exist on that class.
*
* @return void
*/
public function testAnEventOfAnotherTypeIsIgnored(): void {
$dispatcher = $this->recordingDispatcher();
$sync = $this->spyingSync();
$listener = new OrderFulfilmentTransitionListener(
new BudgetImpactEmitter($dispatcher, new NullLogger()),
$sync,
$this->resolver('OrderFulfilment'),
new NullLogger()
);

$listener->handle(new \OCP\EventDispatcher\GenericEvent());

$this->assertCount(0, $dispatcher->events);
$this->assertCount(0, $sync->syncCalls);

}//end testAnEventOfAnotherTypeIsIgnored()

/**
* THE FAIL-SOFT CONTRACT. This listener runs inside another object's
* transition, so a throw here would roll that transition back. A sync
* that blows up must be logged and swallowed, not propagated — and the
* milestone event that already fired must still stand.
*
* @return void
*/
public function testAThrowingSyncIsSwallowedAndTheMilestoneStillEmitted(): void {
$dispatcher = $this->recordingDispatcher();
$sync = $this->spyingSync();
$sync->throwOnSync = true;

$listener = new OrderFulfilmentTransitionListener(
new BudgetImpactEmitter($dispatcher, new NullLogger()),
$sync,
$this->resolver('OrderFulfilment'),
new NullLogger()
);

$listener->handle(
new ObjectTransitionedEvent(
$this->entity('1201', [
'commitmentId' => 'TN-2026-0001',
'milestoneId' => 'M-EIND',
'deliveryType' => 'eindoplevering',
'approved' => true,
]),
'afronden',
'in-progress',
'completed',
'admin',
'shillinq',
'OrderFulfilment'
)
);

$this->assertCount(
1,
$dispatcher->events,
'the milestone event fires before the sync, so it must survive the sync failing'
);

}//end testAThrowingSyncIsSwallowedAndTheMilestoneStillEmitted()

public function testNonCompletedTransitionIsIgnored(): void {
$dispatcher = $this->recordingDispatcher();
$emitter = new BudgetImpactEmitter($dispatcher, new NullLogger());
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Recognition/RevenueRecognitionServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

namespace OCA\Shillinq\Tests\Unit\Recognition;

use OCA\Shillinq\Recognition\RevenueRecognitionService;
use OCA\Shillinq\Service\RevenueRecognitionService;
use OCP\IAppConfig;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand Down
Loading