]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/plugins/test/test.php
Merge pull request #1698 from ArthurHoaro/feature/plugins-search-filter
[github/shaarli/Shaarli.git] / tests / plugins / test / test.php
index ae5032dd36a5b19fc999c387c008ff781481c70c..8dbb3f9464c8905fc5c5ed50f702102c1e3ec7a1 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Shaarli\Bookmark\Bookmark;
+
 /**
  * Hook for test.
  *
@@ -13,6 +15,9 @@ function hook_test_random($data)
         $data[1] = 'page test';
     } elseif (isset($data['_LOGGEDIN_']) && $data['_LOGGEDIN_'] === true) {
         $data[1] = 'loggedin';
+    } elseif (array_key_exists('_LOGGEDIN_', $data)) {
+        $data[1] = 'loggedin';
+        $data[2] = $data['_LOGGEDIN_'];
     } else {
         $data[1] = $data[0];
     }
@@ -24,3 +29,24 @@ function hook_test_error()
 {
     new Unknown();
 }
+
+function test_register_routes(): array
+{
+    return [
+        [
+            'method' => 'GET',
+            'route' => '/test',
+            'callable' => 'getFunction',
+        ],
+        [
+            'method' => 'POST',
+            'route' => '/custom',
+            'callable' => 'postFunction',
+        ],
+    ];
+}
+
+function hook_test_filter_search_entry(Bookmark $bookmark, array $context): bool
+{
+    return $context['_result'];
+}