@@ -68,10 +68,44 @@ public function tearDown() {
6868 public function test_wp_api_installed () {
6969 global $ test_root ;
7070
71- $ this ->assertEquals ( '/tmp/wordpress/tests ' , $ test_root );
72- $ rest_api = dirname ( $ test_root ) . '/wp-content/plugins/rest-api/plugin.php ' ;
73- $ this ->assertEquals ( '/tmp/wordpress/wp-content/plugins/rest-api/plugin.php ' , $ rest_api );
74- $ this ->assertTrue ( file_exists ( $ rest_api ) );
71+ $ rest_api = '' ;
72+
73+ if (
74+ ( $ rest_api = CMB2_WP_CONTENT . '/plugins/WP-API/plugin.php ' )
75+ && file_exists ( $ rest_api )
76+ ) {
77+ require_once $ rest_api ;
78+ } elseif (
79+ ( $ rest_api = CMB2_WP_CONTENT . '/plugins/rest-api/plugin.php ' )
80+ && file_exists ( $ rest_api )
81+ ) {
82+ require_once $ rest_api ;
83+ } elseif (
84+ ( $ rest_api = dirname ( $ test_root ) . '/wp-content/plugins/rest-api/plugin.php ' )
85+ && file_exists ( $ rest_api )
86+ ) {
87+ require_once $ rest_api ;
88+ } elseif (
89+ ( $ rest_api = dirname ( dirname ( $ test_root ) ) . '/wordpress/wp-content/plugins/rest-api/plugin.php ' )
90+ && file_exists ( $ rest_api )
91+ ) {
92+ require_once $ rest_api ;
93+ } elseif (
94+ ( $ rest_api = dirname ( dirname ( dirname ( dirname ( __FILE__ ) ) ) ) . '/plugins/rest-api/plugin.php ' )
95+ && file_exists ( $ rest_api )
96+ ) {
97+ require_once $ rest_api ;
98+ }
99+
100+ $ this ->assertEquals ( array (
101+ '/tmp/wordpress/tests ' ,
102+ dirname ( dirname ( dirname ( dirname ( __FILE__ ) ) ) ) . '/plugins/WP-API/plugin.php ' ,
103+ true
104+ ), array (
105+ $ test_root ,
106+ $ rest_api ,
107+ file_exists ( $ rest_api ),
108+ ) );
75109 }
76110
77111 public function test_rest_posts_controller_exists () {
0 commit comments