-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH Allow File.keep_archived_assets to show files archive tab
- Loading branch information
1 parent
4a57298
commit bcc4ffb
Showing
2 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace SilverStripe\VersionedAdmin\Tests\Extensions; | ||
|
||
use SilverStripe\Dev\SapphireTest; | ||
use SilverStripe\Assets\AssetControlExtension; | ||
use SilverStripe\Core\Config\Config; | ||
use SilverStripe\Assets\File; | ||
|
||
class FileArchiveExtensionTest extends SapphireTest | ||
{ | ||
/** | ||
* @dataProvider provideIsArchiveFieldEnabled | ||
*/ | ||
public function testIsArchiveFieldEnabled( | ||
bool $assetControlExtension, | ||
bool $file, | ||
bool $expected | ||
): void { | ||
Config::modify()->set(AssetControlExtension::class, 'keep_archived_assets', $assetControlExtension); | ||
Config::modify()->set(File::class, 'keep_archived_assets', $file); | ||
$actual = File::singleton()->isArchiveFieldEnabled(); | ||
$this->assertSame($expected, $actual); | ||
} | ||
|
||
public function provideIsArchiveFieldEnabled(): array | ||
{ | ||
return [ | ||
[ | ||
'assetControlExtension' => false, | ||
'file' => false, | ||
'expected' => false, | ||
], | ||
[ | ||
'assetControlExtension' => true, | ||
'file' => false, | ||
'expected' => true, | ||
], | ||
[ | ||
'assetControlExtension' => false, | ||
'file' => true, | ||
'expected' => true, | ||
], | ||
[ | ||
'assetControlExtension' => true, | ||
'file' => true, | ||
'expected' => true, | ||
], | ||
]; | ||
} | ||
} |