Skip to content

Commit

Permalink
Add a basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall committed Nov 17, 2024
1 parent 365fa8d commit 61f2761
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
20 changes: 20 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "drupal/turnstile_protect",
"description": "Put your site routes behind a Cloudflare Turnstile",
"type": "drupal-module",
"license": "GPL-2.0+",
"homepage": "https://www.drupal.org/project/turnstile_protect",
"support": {
"issues": "https://www.drupal.org/project/issues/turnstile_protect"
},
"authors": [
{
"name": "Joe Corall",
"email": "[email protected]",
"role": "Owner"
}
],
"require" : {
"drupal/turnstile": "^1"
}
}
38 changes: 38 additions & 0 deletions tests/src/Kernel/TurnstileProtect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace Drupal\Tests\turnstile_protect\Kernel;

use Drupal\KernelTests\KernelTestBase;

/**
* Tests basic functionality of the YourModule module.
*
* @group turnstile_protect
*/
class TurnstileProtectTest extends KernelTestBase {

/**
* {@inheritdoc}
*/
protected static $modules = [
'turnstile_protect',
'system',
];

/**
* Tests if the module is enabled.
*/
public function testModuleEnabled() {
$this->assertTrue($this->container->get('module_handler')->moduleExists('turnstile_protect'), 'The turnstile_protect module is enabled.');
}

/**
* Tests basic configuration or service.
*/
public function testBasicFunctionality() {
// Example: Check a service or configuration provided by your module.
$config = $this->config('turnstile_protect.settings');
$this->assertNotEmpty($config, 'turnstile_protect settings configuration is available.');
}

}

0 comments on commit 61f2761

Please sign in to comment.