@@ -23,7 +23,7 @@ public function setUp(): void {
23
23
$ this ->test ->dest_lang = 'it_IT ' ;
24
24
}
25
25
26
- public static function provider_validate (): array {
26
+ public static function providerValidate (): array {
27
27
$ post = \Mockery::mock ( \WP_Post::class );
28
28
return array (
29
29
array ( null , null , null , null , null , false ),
@@ -36,14 +36,41 @@ public static function provider_validate(): array {
36
36
}
37
37
38
38
/**
39
- * @dataProvider provider_validate
39
+ * @dataProvider providerValidate
40
40
*/
41
- public function test_validate ( $ post_a , $ post_b , $ source_post , $ lang_a , $ lang_b , $ expected ): void {
41
+ public function testValidate ( $ post_a , $ post_b , $ source_post , $ lang_a , $ lang_b , $ expected ): void {
42
42
Functions \expect ( 'get_blog_post ' )->andReturn ( $ post_a , $ post_b );
43
43
Functions \expect ( 'get_blog_option ' )->andReturn ( $ lang_a , $ lang_b );
44
44
45
45
$ this ->test ->source_post = $ source_post ;
46
46
47
47
$ this ->assertEquals ( $ expected , $ this ->test ->validate () );
48
48
}
49
+
50
+ public function testParseImportersFromPost (): void {
51
+ Functions \expect ( 'filter_has_var ' )
52
+ ->once ()
53
+ ->with ( INPUT_POST , ImportCoordinates::IMPORTERS_GLOBAL_KEY )
54
+ ->andReturn ( false );
55
+ Functions \expect ( 'filter_has_var ' )
56
+ ->once ()
57
+ ->with ( INPUT_GET , ImportCoordinates::IMPORTERS_GLOBAL_KEY )
58
+ ->andReturn ( true );
59
+ Functions \expect ( 'filter_input ' )
60
+ ->once ()
61
+ ->with ( INPUT_GET , ImportCoordinates::IMPORTERS_GLOBAL_KEY , FILTER_FORCE_ARRAY )
62
+ ->andReturn ( array ( 'pagesType ' => 'pagesSlug ' ) );
63
+
64
+ $ this ->assertNull ( $ this ->test ->get_importer_for ( 'pagesType ' ) );
65
+
66
+ $ this ->test ->parse_importers_from_request ();
67
+
68
+ $ this ->assertEquals ( 'pagesSlug ' , $ this ->test ->get_importer_for ( 'pagesType ' ) );
69
+ }
70
+
71
+ public function testSetImporterFor (): void {
72
+ $ this ->test ->set_importer_for ( 'postsType ' , 'postsSlug ' );
73
+
74
+ $ this ->assertEquals ( 'postsSlug ' , $ this ->test ->get_importer_for ( 'postsType ' ) );
75
+ }
49
76
}
0 commit comments