0a1da40788
Fix the existing test
2020-11-14 12:52:36 +00:00
0c6fa6e60f
Throw an Exception if it is the wrong type
2020-11-14 12:52:22 +00:00
4be8e02246
Only articles should be used for Posts
...
An Exception should be thrown if the node passed to the `Post` entity is
not an article.
> Drupal\Tests\my_module\Unit\Entity\PostTest::it_throws_an_exception_if_the_node_is_not_an_article
> Failed asserting that exception of type "InvalidArgumentException" is
thrown.
2020-11-14 12:44:42 +00:00
655c854a80
5e: Fix the kernel tests
2020-11-14 12:38:17 +00:00
8f8218260b
5d: Ensure the label will return the title
2020-11-14 10:09:38 +00:00
bd68420fc1
5d: Create a mock node
...
> TypeError: Return value of Drupal\my_module\Entity\Post::getTitle()
> must be of the type string, null returned
2020-11-14 10:09:38 +00:00
0b4c648ac6
5c: Return the node label
2020-11-14 10:09:38 +00:00
61664cb263
5c: Add the node as a constructor argument
...
> Undefined variable: node
2020-11-14 10:09:38 +00:00
1fe7119b5d
5b: Add getTitle() method
...
> Failed asserting that two strings are identical
2020-11-14 10:09:38 +00:00
07ad4dc2b1
5b: Check that it returns the post title
...
> Drupal\Tests\my_module\Unit\Entity\PostTest::it_returns_the_title
> Error: Call to undefined method Drupal\my_module\Entity\Post::getTitle()
2020-11-14 10:09:38 +00:00
cbd0176c37
5a: Add a unit test for the Post class
2020-11-14 10:09:38 +00:00
259f077f61
4m: Return a Post rather than a node
2020-11-14 10:09:38 +00:00
9aec327945
4l: Expect a custom Post class to be returned
2020-11-14 10:09:38 +00:00
290c8fbcba
4k: Sort articles before returning
2020-11-14 10:09:38 +00:00
91f7d094e7
4k: Articles are returned in the correct order
2020-11-14 10:09:38 +00:00
e925409f5f
4j: Add status condition to getAll()
2020-11-14 10:09:38 +00:00
a540f4ad32
4j: Only published articles are returned
2020-11-14 10:09:38 +00:00
2cae42ba3a
4i: Add type condition in getAll() method
2020-11-14 10:09:38 +00:00
910af32309
4i: Add page nodes too
2020-11-14 10:09:38 +00:00
1be8440519
4h: Ensure that only articles are returned
2020-11-14 10:09:38 +00:00
40228b36f4
4g: Add more assertions
2020-11-14 10:09:38 +00:00
3723a0af0e
4g: Install node_access table
2020-11-14 10:09:38 +00:00
b53cfec4dd
4g: Install config for the filter module
2020-11-14 10:09:38 +00:00
48c2724736
4g: Add an article
2020-11-14 10:09:38 +00:00
9b7d9b3feb
4f: Enable the node module
2020-11-14 10:09:38 +00:00
80a1f88b2c
4f: Enable autowiring for ArticleRepository
2020-11-14 10:09:38 +00:00
4dbb334a6f
4f: Use node storage within getAll()
2020-11-14 10:09:38 +00:00
f38f21fdc8
4e: Add getAll() method
2020-11-14 10:09:38 +00:00
f194015f30
4d: Add import and enable the module
2020-11-14 10:09:38 +00:00
a6a2ad22e4
4d: Add ArticleRepository as a service
2020-11-14 10:09:38 +00:00
699122e83a
4d: Create the ArticleRepository
2020-11-14 10:09:38 +00:00
3e46173860
4c: Try to load the ArticleRepository
2020-11-14 10:09:38 +00:00
48ab1c9209
4b: Test it returns blog posts
2020-11-14 10:09:38 +00:00
9484d924a1
3e: Add page text
...
Replace the empty render array with one that returns the expected text.
2020-11-14 10:09:38 +00:00
ef1e960f91
3e: Add more assertions
...
Add more assertions to ensure that the correct page title is returned as
well as some text on the page.
This fails as the expected test is not returned.
2020-11-14 10:09:38 +00:00
4583075a3e
3d: Add BlogPageController
...
Add the BlogPageController that is referenced within
`my_module.routing.yml`.
We will need to return a render array, but for now let’s return an empty
array.
The test now passes as we are getting the expected response code.
2020-11-14 10:09:38 +00:00
782648fef2
3c: Enable the node module
...
Enable the node module within the test to add the `access content`
permission.
This fails, and returns a 500 response code rather than the expected 200
response code.
2020-11-14 10:09:38 +00:00
c7ef94c0d5
3b: Add blog page route
...
Add a `my_module.routing.yml` file that adds the missing route for
`/blog`.
This fails, and returns a 403 response code rather than the expected 200
response code.
2020-11-14 10:09:38 +00:00
151803382e
3a: Add blog page functional test
...
Add the new `BlogPageTest` functional test to ensure that anonymous
users can access the `/blog` page.
This fails, and returns a 404 response code rather than the expected 200
response code.
2020-11-14 10:09:38 +00:00
9df597c965
2b: Admin page access for admin users
...
Ensure that users with the `access administration pages` permission can
access the site’s administration pages.
2020-11-14 10:09:38 +00:00
7e0a0c3762
2a: Admin page access for anonymous users
...
Ensure that anonymous users cannot access the site’s administration
pages.
2020-11-14 10:09:38 +00:00
fd921d3e4c
1d: Add first functional test
...
Ensure that anonymous users can view the site’s front page.
2020-11-14 10:09:38 +00:00
2dafec2f67
1b: Add my_module.info.yml
...
Add the my_module.info.yml file so that the module can be enabled.
2020-11-14 10:09:38 +00:00
e859418cbd
Initial commit
2020-11-14 10:09:37 +00:00