make(BlueprintsService::class, [ 'getBoard' => fn () => [['title' => 'My SWOT', 'projectId' => 1]], 'getBoardItems' => fn () => [ [ 'box' => 'swot_strengths', 'description' => 'Strong brand', 'author' => 5, 'status' => '', 'relates' => '', 'assumptions' => '', 'data' => '', 'conclusion' => '', 'created' => '2026-01-01 00:00:00', 'modified' => '2026-01-02 00:00:00', 'authorFirstname' => 'Jo', 'authorLastname' => 'Doe', ], ], 'getTranslatedBoxes' => fn () => [ 'swot_strengths' => ['title' => 'Strengths'], 'swot_weaknesses' => ['title' => 'Weaknesses'], ], ]); $xml = (new BlueprintsExport($service, new TemplateRegistry))->exportToXml(7, 'swot'); $this->assertNotNull($xml); $this->assertStringContainsString('', $xml); $this->assertStringContainsString('My SWOT', $xml); $this->assertStringContainsString('', $xml); $this->assertStringContainsString('Strong brand', $xml); // An empty box still emits its element wrapper. $this->assertStringContainsString('', $xml); } public function test_returns_null_for_unknown_canvas_type(): void { $export = new BlueprintsExport( $this->make(BlueprintsService::class), new TemplateRegistry, ); $this->assertNull($export->exportToXml(7, 'doesnotexist')); } public function test_returns_null_when_board_does_not_exist(): void { // getBoard returns false for a missing/foreign/unauthorized board. $service = $this->make(BlueprintsService::class, ['getBoard' => fn () => false]); $export = new BlueprintsExport($service, new TemplateRegistry); $this->assertNull($export->exportToXml(7, 'swot')); } }