diff --git a/tests/unit/Newsletter/ShortcodesHelperTest.php b/tests/unit/Newsletter/ShortcodesHelperTest.php new file mode 100644 index 0000000000..1fd0edca4a --- /dev/null +++ b/tests/unit/Newsletter/ShortcodesHelperTest.php @@ -0,0 +1,38 @@ +equals( + array( + 'Subscriber', + 'Newsletter', + 'Post Notifications', + 'Date', + 'Links' + ) + ); + } + + function testItCanGetCustomShortShortcodes() { + $shortcodes = ShortcodesHelper::getShortcodes(); + expect(count($shortcodes['Subscriber']))->equals(5); + $custom_field = CustomField::create(); + $custom_field->name = 'name'; + $custom_field->type = 'type'; + $custom_field->save(); + $shortcodes = ShortcodesHelper::getShortcodes(); + expect(count($shortcodes['Subscriber']))->equals(6); + $custom_subscriber_shortcode = end($shortcodes['Subscriber']); + expect($custom_subscriber_shortcode['text'])->equals($custom_field->name); + expect($custom_subscriber_shortcode['shortcode']) + ->equals('subscriber:cf_' . $custom_field->id); + } + + function _after() { + ORM::raw_execute('TRUNCATE ' . CustomField::$_table); + } +} \ No newline at end of file