33namespace Yoast \AcfAnalysis \Tests \Configuration ;
44
55use Brain \Monkey ;
6- use Brain \Monkey \Functions ;
76use Brain \Monkey \Filters ;
7+ use Brain \Monkey \Functions ;
88
99class ConfigurationTest extends \PHPUnit_Framework_TestCase {
1010
@@ -15,13 +15,6 @@ protected function setUp() {
1515
1616 public function testEmpty () {
1717
18- $ version = '4.0.0 ' ;
19-
20- Functions \expect ( 'get_option ' )
21- ->once ()
22- ->with ( 'acf_version ' )
23- ->andReturn ( $ version );
24-
2518 $ configuration = new \Yoast_ACF_Analysis_Configuration (
2619 new \Yoast_ACF_Analysis_String_Store (),
2720 new \Yoast_ACF_Analysis_String_Store (),
@@ -31,7 +24,7 @@ public function testEmpty() {
3124 $ this ->assertSame (
3225 [
3326 'pluginName ' => \Yoast_ACF_Analysis_Facade::get_plugin_name (),
34- 'acfVersion ' => $ version ,
27+ 'acfVersion ' => ' version ' ,
3528 'scraper ' => [],
3629 'refreshRate ' => 1000 ,
3730 'blacklistType ' => [],
@@ -42,6 +35,21 @@ public function testEmpty() {
4235 $ configuration ->to_array ()
4336 );
4437
38+ $ this ->assertEquals ( Filters \applied ( 'acf/get_info ' ), 1 );
39+ }
40+
41+ public function testACF5VersionFunction () {
42+ $ acf_version = '5.0.0 ' ;
43+ Functions \when ( 'acf_get_setting ' )->justReturn ( $ acf_version );
44+
45+ $ configuration = new \Yoast_ACF_Analysis_Configuration (
46+ new \Yoast_ACF_Analysis_String_Store (),
47+ new \Yoast_ACF_Analysis_String_Store (),
48+ new \Yoast_ACF_Analysis_String_Store ()
49+ );
50+ $ config = $ configuration ->to_array ();
51+
52+ $ this ->assertEquals ( $ acf_version , $ config ['acfVersion ' ] );
4553 }
4654
4755 public function testBlacklistTypeFilter () {
@@ -180,8 +188,8 @@ public function testBlacklistNameFilterInvalid() {
180188 $ this ->assertSame ( $ store , $ configuration ->get_blacklist_name () );
181189 }
182190
183- public function testScraperConfigFilter (){
184- $ config = array ();
191+ public function testScraperConfigFilter () {
192+ $ config = array ();
185193 $ blacklist = new \Yoast_ACF_Analysis_String_Store ();
186194
187195 $ configuration = new \Yoast_ACF_Analysis_Configuration (
@@ -198,7 +206,7 @@ public function testScraperConfigFilter(){
198206 $ this ->assertSame ( $ config , $ configuration ->get_scraper_config () );
199207 }
200208
201- public function testInvalidScraperConfigFilter (){
209+ public function testInvalidScraperConfigFilter () {
202210 $ blacklist = new \Yoast_ACF_Analysis_String_Store ();
203211
204212 $ configuration = new \Yoast_ACF_Analysis_Configuration (
@@ -245,8 +253,8 @@ public function testRefreshRateMinimumValueFilter() {
245253 $ this ->assertSame ( 200 , $ configuration ->get_refresh_rate () );
246254 }
247255
248- public function testFieldSelectorsFilter (){
249- $ custom_store = new \Yoast_ACF_Analysis_String_Store ();
256+ public function testFieldSelectorsFilter () {
257+ $ custom_store = new \Yoast_ACF_Analysis_String_Store ();
250258 $ field_selector = new \Yoast_ACF_Analysis_String_Store ();
251259
252260 $ configuration = new \Yoast_ACF_Analysis_Configuration (
0 commit comments