get(self::ENDPOINT_PATH, []); $this->assertCount(1, $result['data']); $this->assertEquals('simple-welcome-email', $result['data'][0]['slug']); } public function testGuestNotAllowed(): void { wp_set_current_user(0); $data = $this->get(self::ENDPOINT_PATH, []); $this->assertSame([ 'code' => 'rest_forbidden', 'message' => 'Sorry, you are not allowed to do that.', 'data' => ['status' => 401], ], $data); } public function testGetTemplatesByCategory() { //@ToDo: Once we have templates in other categories, we should make this test more specific. $result = $this->get(self::ENDPOINT_PATH, [ 'json' => [ 'category' => 1, ], ]); $this->assertCount(1, $result['data']); $result = $this->get(self::ENDPOINT_PATH, [ 'json' => [ 'category' => 2, ], ]); $this->assertCount(0, $result['data']); } }