forked from sunnysideup/silverstripe-dms
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: continue with patching old tests and wrong configuration
- Loading branch information
Showing
22 changed files
with
135 additions
and
1,125 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ npm-debug.log | |
/public | ||
/resources | ||
.phpunit.result.cache | ||
/app |
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
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
<coverage includeUncoveredFiles="true"> | ||
<include> | ||
<directory suffix=".php">src/.</directory> | ||
</include> | ||
<exclude> | ||
<directory suffix=".php">tests/</directory> | ||
</exclude> | ||
</coverage> | ||
<testsuites> | ||
<testsuite name="Default"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
<coverage includeUncoveredFiles="true"> | ||
<include> | ||
<directory suffix=".php">src/.</directory> | ||
</include> | ||
<exclude> | ||
<directory suffix=".php">tests/</directory> | ||
</exclude> | ||
</coverage> | ||
<testsuites> | ||
<testsuite name="Default"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
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 |
---|---|---|
|
@@ -9,4 +9,6 @@ class DMS | |
use Configurable; | ||
|
||
private static $folder_name = 'dms'; | ||
|
||
private static $shortcode_handler_key = 'dms'; | ||
} |
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,35 @@ | ||
<?php | ||
|
||
namespace Sunnysideup\DMS; | ||
|
||
use SilverStripe\View\Parsers\ShortcodeParser; | ||
use Sunnysideup\DMS\Model\DMSDocument; | ||
|
||
class DMSShortcodeHandler | ||
{ | ||
public static function handle($arguments, $content, ShortcodeParser $parser, $tag, array $extra = []) | ||
{ | ||
if (!empty($arguments['id'])) { | ||
$document = DMSDocument::get()->byID($arguments['id']); | ||
|
||
if ($document && !$document->isHidden()) { | ||
if ($content) { | ||
return sprintf( | ||
'<a href="%s">%s</a>', | ||
$document->Link(), | ||
$parser->parse($content) | ||
); | ||
} | ||
|
||
if (isset($extra['element'])) { | ||
$extra['element']->setAttribute('data-ext', $document->getExtension()); | ||
$extra['element']->setAttribute('data-size', $document->getFileSizeFormatted()); | ||
} | ||
|
||
return $document->Link(); | ||
} | ||
} | ||
|
||
return ''; | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.