BDD on a Real 4wp.dev Plugin: AI Writes the Code, You Define the Behavior

AI writes the code in seconds. What the code should do is still your call. 🎯 Behavior-Driven Development for WordPress on a real 4wp.dev plugin: 4WP Social builds a Bluesky post. 300 characters, hashtags only while they fit. Behavior → Given / When / Then → PHPUnit test → code → green.

The case

TEXT
Scenario: hashtags only while they fit
  Given description "Demo #WordPress"
    And tags "WordPress", "FAQ schema"
  When 4WP Social builds the Bluesky text
  Then the text is "Demo #WordPress\n\n#FAQschema"

The same scenario lives in 4WP Social as test_text_adds_hashtags_only_while_they_fit(). Bluesky_Adapter::text() adds hashtags one by one and stops when the next one does not fit. vendor/bin/phpunit --filter BlueskyTest → OK (5 tests, 11 assertions).

Go deeper