-
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.
Fixes #15 (Moodle 3.3)
- Loading branch information
Showing
6 changed files
with
118 additions
and
9 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
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,54 @@ | ||
<?php | ||
// This file is part of the Twitter Card local plugin for Moodle | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Privacy Subsystem implementation for local_twittercard. | ||
* | ||
* @package local_twittercard | ||
* @copyright 2018 Matteo Scaramuccia <moodle@matteoscaramuccia.com> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace local_twittercard\privacy; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
// Backward compat. | ||
interface_exists('\core_privacy\local\metadata\null_provider') || die(); | ||
|
||
// 3.3 runs even on PHP 5.6 so 'return type declaration' is not supported: | ||
// the privacy null_provider interface has been implemented in 3.3 accordingly. | ||
|
||
/** | ||
* Privacy Subsystem implementation for local_twittercard implementing null_provider. | ||
* | ||
* @package local_twittercard | ||
* @copyright 2018 Matteo Scaramuccia <moodle@matteoscaramuccia.com> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class provider implements | ||
// This plugin does not store any personal user data. | ||
\core_privacy\local\metadata\null_provider { | ||
/** | ||
* Get the language string identifier with the component's language | ||
* file to explain why this plugin stores no data. | ||
* | ||
* @return string | ||
*/ | ||
public static function get_reason() { | ||
return 'privacy:metadata'; | ||
} | ||
} |
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,49 @@ | ||
<?php | ||
// This file is part of the Twitter Card local plugin for Moodle | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Tests for the Privacy API implementation in Twitter summary card. | ||
* | ||
* @package local_twittercard | ||
* @copyright 2018 Matteo Scaramuccia <moodle@matteoscaramuccia.com> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
/** | ||
* Class local_twittercard_privacy_testcase | ||
* | ||
* @package local_twittercard | ||
* @copyright 2017 Matteo Scaramuccia <moodle@matteoscaramuccia.com> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class local_twittercard_privacy_testcase extends advanced_testcase { | ||
/** | ||
* Tests that local_twittercard actually implements the Privacy API null_provider. | ||
*/ | ||
public function test_null_provider() { | ||
if (!interface_exists('\core_privacy\local\metadata\null_provider')) { | ||
$this->markTestSkipped('The Moodle code does not implement the Moodle Privacy API'); | ||
} | ||
|
||
$this->assertTrue(class_exists('\local_twittercard\privacy\provider')); | ||
$this->assertEquals( | ||
[ 'core_privacy\local\metadata\null_provider' => 'core_privacy\local\metadata\null_provider' ], | ||
class_implements('\local_twittercard\privacy\provider') | ||
); | ||
} | ||
} |
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