|
20 | 20 | use App\Test\Factory\GpgkeyFactory;
|
21 | 21 | use App\Test\Factory\UserFactory;
|
22 | 22 | use App\Test\Lib\AppIntegrationTestCaseV5;
|
| 23 | +use Cake\Core\Configure; |
23 | 24 | use Passbolt\Folders\FoldersPlugin;
|
24 | 25 | use Passbolt\Folders\Test\Factory\FolderFactory;
|
| 26 | +use Passbolt\Metadata\Model\Dto\MetadataFolderDto; |
25 | 27 | use Passbolt\Metadata\Test\Factory\MetadataKeyFactory;
|
26 | 28 | use Passbolt\Metadata\Test\Utility\GpgMetadataKeysTestTrait;
|
27 | 29 |
|
@@ -286,4 +288,23 @@ public function testMetadataFoldersIndexController_Success_FilterHasParent()
|
286 | 288 | $this->assertSame($metadata, $result['metadata']);
|
287 | 289 | $this->assertSame($parentFolder->get('id'), $result['folder_parent_id']);
|
288 | 290 | }
|
| 291 | + |
| 292 | + public function testMetadataFoldersIndexController_Metadata_Disabled_Success(): void |
| 293 | + { |
| 294 | + Configure::write('passbolt.v5.enabled', false); |
| 295 | + |
| 296 | + $user = $this->logInAsUser(); |
| 297 | + FolderFactory::make(3)->withPermissionsFor([$user])->persist(); |
| 298 | + FolderFactory::make(3)->withPermissionsFor([$user])->v5Fields([ |
| 299 | + 'metadata' => 'foo', |
| 300 | + ])->persist(); |
| 301 | + |
| 302 | + $this->getJson('/folders.json?sort=Folders.modified'); |
| 303 | + $this->assertSuccess(); |
| 304 | + $response = (array)json_decode(json_encode($this->_responseJsonBody), true); |
| 305 | + $this->assertCount(3, $response); |
| 306 | + $this->assertSame([0, 1, 2], array_keys($response)); |
| 307 | + $folderV4 = array_pop($response); |
| 308 | + $this->assertArrayHasAttributes(MetadataFolderDto::V4_META_PROPS, $folderV4); |
| 309 | + } |
289 | 310 | }
|
0 commit comments