/** Feature for testing */
const CAN_TEST = 'test';
- /**
- * Returns the URL where the content will be visualized.
- *
- * @param content $content The content to delete.
- * @return string URL where to visualize the given content.
- */
- public function get_view_url(\core_contentbank\content $content): string {
- $fileurl = $this->get_file_url($content->get_id());
- $url = $fileurl."?forcedownload=1";
-
- return $url;
- }
-
/**
* Returns the HTML code to render the icon for content bank contents.
*
}
/**
- * Test the content updated event.
+ * Test the content viewed event.
*
* @covers ::create_from_record
*/
- public function test_content_updated() {
+ public function test_content_viewed() {
$this->resetAfterTest();
$this->setAdminUser();
// Save the system context.
$systemcontext = \context_system::instance();
+ $contenttype = new \contenttype_testable\contenttype();
// Create a content bank content.
$generator = $this->getDataGenerator()->get_plugin_generator('core_contentbank');
// Trigger and capture the content viewed event.
$sink = $this->redirectEvents();
- $eventtotrigger = \core\event\contentbank_content_viewed::create_from_record($content->get_content());
- $eventtotrigger->trigger();
+ $result = $contenttype->get_view_content($content);
+ $this->assertEmpty($result);
$events = $sink->get_events();
$event = reset($events);
// Check that the event data is valid.
$this->assertInstanceOf('\core\event\contentbank_content_viewed', $event);
$this->assertEquals($systemcontext, $event->get_context());
+ $this->assertEquals($content->get_id(), $event->objectid);
}
}