From af25afe2cf877b27ae3822dedca971ebef8e03db Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 4 Jan 2021 19:10:05 +0000 Subject: [PATCH] Test that a queue entry is added for a post References #328 --- .../src/Kernel/PushToSocialMediaTest.php | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 web/modules/custom/blog/tests/src/Kernel/PushToSocialMediaTest.php diff --git a/web/modules/custom/blog/tests/src/Kernel/PushToSocialMediaTest.php b/web/modules/custom/blog/tests/src/Kernel/PushToSocialMediaTest.php new file mode 100644 index 0000000..5fdd93f --- /dev/null +++ b/web/modules/custom/blog/tests/src/Kernel/PushToSocialMediaTest.php @@ -0,0 +1,56 @@ +assertSame(0, $this->queue->numberOfItems()); + + $this->createNode([ + 'title' => 'Ignoring PHPCS sniffs within PHPUnit tests', + 'type' => 'post', + ]); + + $this->assertSame(1, $this->queue->numberOfItems()); + } + + protected function setUp() { + parent::setUp(); + + $this->installConfig(['filter', 'opdavies_blog_test']); + + $this->installSchema('node', ['node_access']); + + $this->queue = $this->container->get('queue') + ->get('push_post_to_social_media'); + } + +}