Closed finnlewis closed 3 months ago
@opdavies is going to take a look at adding some tests.
Then, hopefully we can review the other issues on https://github.com/localgovdrupal/localgov_microsites/issues/378 and release 4.0.0
Once the tests are there it would be nice to move the code from the present route/form based approach to using the permissions in the variation cache by domain. But I think having the tests there is the safeguard we need.
I've started looking at this, and have begun to write a new functional test based on GroupAdminAccessTest
.
My first observation is that it's very slow to run, taking 2 or 3 minutes to run the single test, although it uses the same setUp()
contents as GroupAdminAccessTest
.
I also get these errors intermittently, which are happening for other tests, too, and not just the one I'm writing:
There was 1 risky test:
1) Drupal\Tests\localgov_microsites_directories\Functional\MicrositeDirectoryContentTest::testMicrositeDirectoryContent
This test did not perform any assertions
/var/www/html/web/core/tests/Drupal/Tests/Listeners/DrupalListener.php:62
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:453
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php:685
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php:685
/var/www/html/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:651
/var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php:146
/var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php:99
1) Drupal\Tests\localgov_microsites_group\Functional\DisablingContentTypesTest::test_a
Drupal\Core\Config\ConfigValueException: The hostname (web) is already registered.
Are either of these known issues that have been experienced whilst writing the existing tests?
This test did not perform any assertions
seems to happen when I add localgov_microsites_events
to the $modules
list, but I can work around it by creating the required localgov_event
content type manually within the test.
I'm currently getting this error:
1) Drupal\Tests\localgov_microsites_group\Functional\DisablingContentTypesTest::test_a Invalid permission create group_node:localgov_event entity.
This permission name matches the format used in other modules, and the group
, gnode
and localgov_microsites_group
modules are enabled.
Before trying to add the permission, I received a 403 response code for http://group-1.web//group/1/content/create/group_node:localgov_event instead of the expected 200.
/node/add/localgov_event
is accessible whether the content type is enabled or not so I can't test that path.
I suspect there is further configuration to do in the test between the content type and the group type.
Ach ignore me... updated.
Added a WIP with tasks to do on #469
@ekes am I right in thinking that https://github.com/localgovdrupal/localgov_microsites_group/pull/469 aims to take care of this issue ?
To get to a stable release, @ekes suggested that we should add phpunit tests to confirm that the content type options are being respected.
As a microsites controller,
I want to enable or disable content types for a given microsite
So that I can restrict the content types available to a microsite content designer.
As a 'trusted editor'
I want to only be able; to create see the content types that are enabled.
So that I don't create illegal content types
So we want some phpunit tests as follows.