@@ -1722,6 +1722,59 @@ public function testCreateTagsThatExist()
17221722 $ this ->assertEquals ($ result ->tags [0 ]->name , $ _ENV ['CONVERTKIT_API_TAG_NAME_2 ' ]);
17231723 }
17241724
1725+ /**
1726+ * Test that update_tag_name() returns the expected data.
1727+ *
1728+ * @since 2.2.1
1729+ *
1730+ * @return void
1731+ */
1732+ public function testUpdateTagName ()
1733+ {
1734+ $ result = $ this ->api ->update_tag_name (
1735+ tag_id: (int ) $ _ENV ['CONVERTKIT_API_TAG_ID ' ],
1736+ name: $ _ENV ['CONVERTKIT_API_TAG_NAME ' ],
1737+ );
1738+
1739+ // Assert existing tag is returned.
1740+ $ this ->assertEquals ($ result ->tag ->id , (int ) $ _ENV ['CONVERTKIT_API_TAG_ID ' ]);
1741+ $ this ->assertEquals ($ result ->tag ->name , $ _ENV ['CONVERTKIT_API_TAG_NAME ' ]);
1742+ }
1743+
1744+ /**
1745+ * Test that update_tag_name() throws a ClientException when an invalid
1746+ * tag ID is specified.
1747+ *
1748+ * @since 2.2.1
1749+ *
1750+ * @return void
1751+ */
1752+ public function testUpdateTagNameWithInvalidTagID ()
1753+ {
1754+ $ this ->expectException (ClientException::class);
1755+ $ result = $ this ->api ->update_tag_name (
1756+ tag_id: 12345 ,
1757+ name: $ _ENV ['CONVERTKIT_API_TAG_NAME ' ],
1758+ );
1759+ }
1760+
1761+ /**
1762+ * Test that update_tag_name() throws a ClientException when a blank
1763+ * name is specified.
1764+ *
1765+ * @since 2.2.1
1766+ *
1767+ * @return void
1768+ */
1769+ public function testUpdateTagNameWithBlankName ()
1770+ {
1771+ $ this ->expectException (ClientException::class);
1772+ $ result = $ this ->api ->update_tag_name (
1773+ tag_id: (int ) $ _ENV ['CONVERTKIT_API_TAG_ID ' ],
1774+ name: ''
1775+ );
1776+ }
1777+
17251778 /**
17261779 * Test that tag_subscriber_by_email() returns the expected data.
17271780 *
0 commit comments