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 61cfa00
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 14 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
uses: actions/checkout@v4

- name: lint+test
working-directory: ci
run: docker compose up -d --quiet-pull
env:
PHP_VERSION: ${{ matrix.php-version }}
DRUPAL_VERSION: ${{ matrix.drupal-version }}
run: |
docker run \
--env ENABLE_MODULES=turnstile_protect \
-v $(pwd):/var/www/drupal/web/modules/contrib/turnstile_protect \
lehighlts/drupal-ci:${{ matrix.drupal-version }}-php${{ matrix.php-version }}
9 changes: 0 additions & 9 deletions ci/docker-compose.yml

This file was deleted.

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"
}
}
43 changes: 43 additions & 0 deletions tests/src/Kernel/TurnstileProtectTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?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() {
$config = $this->config('turnstile_protect.settings');
$this->assertNotEmpty(
$config,
'turnstile_protect settings configuration is available.'
);
}

}

0 comments on commit 61cfa00

Please sign in to comment.