PageRenderTime 40ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/features/scaffold.feature

https://github.com/TheLastCicada/wp-cli
Gherkin Specification | 83 lines | 69 code | 12 blank | 2 comment | 4 complexity | b7841cf2b1d637dddb8f2fd5015ce04c MD5 | raw file
  1. Feature: WordPress code scaffolding
  2. Background:
  3. Given a WP install
  4. @theme
  5. Scenario: Scaffold a child theme
  6. Given I run `wp theme path`
  7. And save STDOUT as {THEME_DIR}
  8. When I run `wp scaffold child-theme zombieland --parent_theme=umbrella --theme_name=Zombieland --author=Tallahassee --author_uri=http://www.wp-cli.org --theme_uri=http://www.zombieland.com --activate`
  9. Then STDOUT should not be empty
  10. And the {THEME_DIR}/zombieland/style.css file should exist
  11. @tax @cpt
  12. Scenario: Scaffold a Custom Taxonomy and Custom Post Type and write it to active theme
  13. Given I run `wp eval 'echo STYLESHEETPATH;'`
  14. And save STDOUT as {STYLESHEETPATH}
  15. When I run `wp scaffold taxonomy zombie-speed --theme`
  16. Then the {STYLESHEETPATH}/taxonomies/zombie-speed.php file should exist
  17. When I run `wp scaffold post-type zombie --theme`
  18. Then the {STYLESHEETPATH}/post-types/zombie.php file should exist
  19. # Test for all flags but --label, --theme, --plugin and --raw
  20. @tax
  21. Scenario: Scaffold a Custom Taxonomy and attach it to CPTs including one that is prefixed and has a text domain
  22. When I run `wp scaffold taxonomy zombie-speed --post_types="prefix-zombie,wraith" --textdomain=zombieland`
  23. Then STDOUT should contain:
  24. """
  25. __( 'Zombie speeds'
  26. """
  27. And STDOUT should contain:
  28. """
  29. array( 'prefix-zombie', 'wraith' )
  30. """
  31. And STDOUT should contain:
  32. """
  33. __( 'Zombie speeds', 'zombieland'
  34. """
  35. @tax
  36. Scenario: Scaffold a Custom Taxonomy with label "Speed"
  37. When I run `wp scaffold taxonomy zombie-speed --label="Speed"`
  38. Then STDOUT should contain:
  39. """
  40. __( 'Speeds'
  41. """
  42. And STDOUT should contain:
  43. """
  44. _x( 'Speed', 'taxonomy general name',
  45. """
  46. # Test for all flags but --label, --theme, --plugin and --raw
  47. @cpt
  48. Scenario: Scaffold a Custom Post Type
  49. When I run `wp scaffold post-type zombie --textdomain=zombieland`
  50. Then STDOUT should contain:
  51. """
  52. __( 'Zombies'
  53. """
  54. And STDOUT should contain:
  55. """
  56. __( 'Zombies', 'zombieland'
  57. """
  58. @cpt
  59. Scenario: Scaffold a Custom Post Type with label
  60. When I run `wp scaffold post-type zombie --label="Brain eater"`
  61. Then STDOUT should contain:
  62. """
  63. __( 'Brain eaters'
  64. """
  65. Scenario: Scaffold a plugin
  66. Given I run `wp plugin path`
  67. And save STDOUT as {PLUGIN_DIR}
  68. When I run `wp scaffold plugin hello-world`
  69. Then STDOUT should not be empty
  70. And the {PLUGIN_DIR}/hello-world/hello-world.php file should exist
  71. And the {PLUGIN_DIR}/hello-world/readme.txt file should exist