Commit graph

66 commits

Author SHA1 Message Date
Oliver Davies 568451806e Mock loadByProperties, return mock nodes, add
...assertions
2024-02-09 07:05:22 +00:00
Oliver Davies bc34a96187 Mock loadByProperties, return mock nodes, add
...assertions
2024-02-09 07:05:22 +00:00
Oliver Davies 09f7f528b9 Mock nodeStorage
> TypeError: uasort(): Argument #1 ($array) must be of type array, null given
2024-02-09 07:05:22 +00:00
Oliver Davies 0c162ed08e Try to load posts
> Error: Call to a member function loadByProperties() on null
2024-02-09 07:05:22 +00:00
Oliver Davies 6e00df9ccc Mock EntityTypeManager
> OK, but incomplete, skipped, or risky tests!
> Tests: 1, Assertions: 0, Risky: 1.
2024-02-09 07:05:22 +00:00
Oliver Davies bad5ba5905 Inject a new instance of EntityTypeManager
> ArgumentCountError: Too few arguments to function Drupal\Core\Entity\EntityTypeManager::__construct(), 0 passed in /home/opdavies/Code/github.com/opdavies/atdc/web/modules/custom/example/tests/src/Unit/PostNodeRepositoryUnitTest.php on line 17 and exactly 6 expected
2024-02-09 07:05:22 +00:00
Oliver Davies c54b3efa93 Add PostNodeRepositoryUnitTest
> ArgumentCountError: Too few arguments to function Drupal\example\Repository\PostNodeRepository::__construct(), 0 passed in /home/opdavies/Code/github.com/opdavies/atdc

/web/modules/custom/example/tests/src/Unit/PostNodeRepositoryUnitTest.php on line 15 and exactly 1 expected
2024-02-09 07:05:22 +00:00
Oliver Davies 01289d8711 Add lesson 9 2024-02-09 07:05:22 +00:00
Oliver Davies 2daeca7f8e Throw an Exception if the bundle type is incorrect 2024-01-20 21:02:45 +00:00
Oliver Davies 9f175475c5 Add a test the Exception is thrown 2024-01-20 21:02:28 +00:00
Oliver Davies 196b1f1517 Test node bundle 2024-01-20 21:02:28 +00:00
Oliver Davies e09fdbe5d0 Add expected method result 2024-01-20 21:02:28 +00:00
Oliver Davies 3bede8428f Add an assertion for the bundle type
> Failed asserting that null is identical to 'post'.
2024-01-20 21:02:16 +00:00
Oliver Davies 89a6f933ec Use a mock node 2024-01-20 21:02:16 +00:00
Oliver Davies e0c59ee91a Add a failing unit test
> Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container.
2024-01-20 21:02:09 +00:00
Oliver Davies 58f32fdaf4 Add PHPStan configuration 2024-01-18 16:13:13 +00:00
Oliver Davies 1977b567dc Extract a custom assertion 2024-01-18 16:13:13 +00:00
Oliver Davies 35dcb50798 Assert all tags have the correct bundle 2024-01-18 16:13:13 +00:00
Oliver Davies 2a57ff5983 Assert tag names are correct 2024-01-18 16:13:13 +00:00
Oliver Davies d0b591d57a Save tags to the post 2024-01-18 16:13:13 +00:00
Oliver Davies 81bc39b5c2 Install taxonomy_term entity data 2024-01-18 16:13:13 +00:00
Oliver Davies edbbad9a01 Add setTags
> Drupal\Core\Entity\EntityStorageException: SQLSTATE[HY000]: General error: 1 no such table: t
est93789242.taxonomy_term_data: INSERT INTO "test93789242"."taxonomy_term_data" ("revision_id", "v
id", "uuid", "langcode") VALUES (?, ?, ?, ?); Array
2024-01-18 16:13:11 +00:00
Oliver Davies 19f6f0287a Add tags to the post with PostBuilder
> Error: Call to undefined method Drupal\example\Builder\PostBuilder::setTags()
2024-01-18 13:15:55 +00:00
Oliver Davies 22d61485fd Add tag count assertion
> Failed asserting that actual size 0 matches expected size 3.
2024-01-18 13:14:26 +00:00
Oliver Davies a6d9e9a524 Add post node type configuration
> OK (3 tests, 32 assertions)
2024-01-18 12:13:36 +00:00
Oliver Davies b16833c7b5 Enable taxonomy module
> Exception: Exception when installing config for module example_test, message was: Missing bun
dle entity, entity type node_type, entity id post.
2024-01-18 12:10:13 +00:00
Oliver Davies 26515a9517 Install example_test configuration
> Exception: Exception when installing config for module example_test, message was: Field 'field_tags' on entity type 'node' references a target entity type 'taxonomy_term' which does not exist.
2024-01-18 12:08:02 +00:00
Oliver Davies 5845e37be6 Enable example_test 2024-01-18 12:08:02 +00:00
Oliver Davies da5b7407d0 Add example_test module with field_tags configuration 2024-01-18 12:08:00 +00:00
Oliver Davies 899b63ee1b Add Drush as a dependency 2024-01-18 12:02:11 +00:00
Oliver Davies 380d2c5cfe Add tags test
InvalidArgumentException: Field field_tags is unknown.
2024-01-18 09:35:06 +00:00
Oliver Davies ed7f02cc9e Add unpublished post test 2024-01-18 07:39:28 +00:00
Oliver Davies 2b3f98c43d Add published post test 2024-01-18 07:39:28 +00:00
Oliver Davies e6caccc1b4 Add empty test 2024-01-18 07:39:28 +00:00
Oliver Davies 99d4311eb6 Only load post nodes 2024-01-17 11:03:26 +00:00
Oliver Davies 3eb71026c1 Add only post node test 2024-01-17 11:01:55 +00:00
Oliver Davies 7714b20d3c Only load published nodes 2024-01-17 10:58:35 +00:00
Oliver Davies 529eb1458e Update Builder logic to set the node status 2024-01-17 10:58:35 +00:00
Oliver Davies c2e8d312c8 Add isNotPublished() method 2024-01-17 10:58:35 +00:00
Oliver Davies 7d79a2ea14 Fix integrity constraint violation error 2024-01-17 10:58:35 +00:00
Oliver Davies 86b5c18f8d Add isPublished() method 2024-01-17 10:58:35 +00:00
Oliver Davies 8c3b9438c7 Add published nodes test 2024-01-17 10:58:14 +00:00
Oliver Davies 71e70a56c5 Adding return types 2024-01-17 10:48:33 +00:00
Oliver Davies de5ffc1aee Fix bug in lesson 6 2024-01-17 10:39:39 +00:00
Oliver Davies 812ab02bfa Add a run file with a consistent test task 2024-01-16 15:56:15 +00:00
Oliver Davies 9be750fdf7 Add paratest for running tests in parallel 2024-01-16 09:43:22 +00:00
Oliver Davies 2b2a9facea Add groups to lesson tests 2024-01-15 10:29:12 +00:00
Oliver Davies acaabb14ca Fix .tmux script 2024-01-15 10:09:50 +00:00
Oliver Davies 3db62f83b9 Extract a custom assertion method 2024-01-15 08:51:12 +00:00
Oliver Davies c687deaf5c Refactor to use a PostBuilder 2024-01-15 08:51:12 +00:00