HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/delta/wp-content/themes/delta/vendor/timber/timber/tests/test-timber-comment-thread.php
<?php

	class TestTimberCommentThread extends Timber_UnitTestCase {

		function testCommentThreadWithArgs() {
			$post_id = self::factory()->post->create(array('post_title' => 'Gobbles'));
			$comment_id_array = self::factory()->comment->create_many( 5, array('comment_post_ID' => $post_id) );
			$args = array();
			$ct = new Timber\CommentThread($post_id, $args);
			$this->assertEquals( 5, count($ct) );
		}

		function testShowUnmoderatedCommentIfByAnon() {
			global $wp_version;
			$post_id = self::factory()->post->create();

			$quote = "And in that moment, I was a marine biologist";
			$comment_id = self::factory()->comment->create(array('comment_post_ID' => $post_id, 'comment_content' => $quote,'comment_approved' => 0, 'comment_author_email' => 'jarednova@upstatement.com'));

			$comment = get_comment($comment_id);

			$post = new TimberPost($post_id);
			$this->assertEquals(0, count($post->comments()) );

			$_GET['unapproved'] = $comment->comment_ID;
			$_GET['moderation-hash'] = wp_hash($comment->comment_date_gmt);
			$post = new TimberPost($post_id);
			if ( !function_exists('wp_get_unapproved_comment_author_email') ) {
				$this->assertEquals(0, count( $post->comments() ));
			} else {
				$timber_comment = $post->comments()[0];
				$this->assertEquals($quote, $timber_comment->comment_content);
			}

		}

	}