Guest User

Untitled

a guest
Jun 18th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. require File.dirname(__FILE__) + "/spec_helper"
  2.  
  3.  
  4. WP_DIR = "/Users/#{ENV['USER']}/Projects/wp/wordpress"
  5.  
  6. PHP_INCLUDES ="
  7. include 'post.php';
  8. include '#{WP_DIR}/wp-includes/plugin.php';
  9. include '#{WP_DIR}/wp-content/themes/twentyten/functions.php';
  10. "
  11.  
  12. describe "php haxxored through rspec" do
  13.  
  14. def run_php(php)
  15. `php -r '#{PHP_INCLUDES} #{php}'`
  16.  
  17. end
  18.  
  19. it "should invoke php and return output" do
  20. run_php("echo 'hay!';").should == "hay!"
  21. end
  22.  
  23. it "should invoke function defined in includes" do
  24. run_php("echo testing();").should == "TEST OUTPUT"
  25. end
  26.  
  27. end
Add Comment
Please, Sign In to add comment