Skip to content

PodsTest unit test failing #7472

@devlamconstructie

Description

@devlamconstructie

Description

the PodsTest::test_shortcode_pods() method has some failing unit tests:

1) PodsTest: Test_shortcode_pods
 Test  tests/codeception/wpunit/Pods/Shortcode/PodsTest.php:test_shortcode_pods
Failed asserting that two strings are equal.
- Expected | + Actual
@@ @@
-'5'
+'<!-- pods:access-notices/user/hidden-by-setting {&quot;object_type&quot;:&quot;pod&quot;,&quot;object_name&quot;:&quot;test_pods&quot;,&quot;item_id&quot;:null} -->'
[...]

2) PodsTest: Test_shortcode_pods_field_in_shortcode
 Test  tests/codeception/wpunit/Pods/Shortcode/PodsTest.php:test_shortcode_pods_field_in_shortcode
Failed asserting that two strings are equal.
- Expected | + Actual
@@ @@
-'5'
+''
[...]

3) PodsTest: Test_shortcode_pods_form
 Test  tests/codeception/wpunit/Pods/Shortcode/PodsTest.php:test_shortcode_pods_form
Failed asserting that '<!-- pods:access-notices/user/hidden-by-setting {&quot;object_type&quot;:&quot;pod&quot;,&quot;object_name&quot;:&quot;test_pods&quot;,&quot;item_id&quot;:null} -->' contains "Anonymous form submissions are not enabled for this site".
[...]

4) PodsTest: Test_shortcode_pods_form_with_anon_enabled
 Test  tests/codeception/wpunit/Pods/Shortcode/PodsTest.php:test_shortcode_pods_form_with_anon_enabled
Failed asserting that '<!-- pods:access-notices/user/hidden-by-setting {&quot;object_type&quot;:&quot;pod&quot;,&quot;object_name&quot;:&quot;test_pods&quot;,&quot;item_id&quot;:null} -->' contains "Anonymous form submissions are not compatible with sessions on this site".
[...]

5) PodsTest: Test_shortcode_pods_form_with_anon_enabled_and_compatible
 Test  tests/codeception/wpunit/Pods/Shortcode/PodsTest.php:test_shortcode_pods_form_with_anon_enabled_and_compatible
Failed asserting that '<!-- pods:access-notices/user/hidden-by-setting {&quot;object_type&quot;:&quot;pod&quot;,&quot;object_name&quot;:&quot;test_pods&quot;,&quot;item_id&quot;:null} -->' contains "<form".
[...]

it seems that these test failures are related to the setup of the pod item earlier

	$this->pod_id = $api->save_pod( array(
			'type'   => 'pod',
			'name'   => $this->pod_name,
		) );

it seems the 'public'=> 1 option is missing from the parameters. When added, the tests pass.

With this option the tests pass.

Version

release 3.3.5

Testing Instructions

run vendor/bin/codecept run wpunit tests/codeception/wpunit/Pods/Shortcode/PodsTest.php:test_shortcode_pods -v from the pods dir.

Screenshots / Screencast

No response

Possible Workaround

No response

Site Health Information


Pods Package

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions