[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: CronTest.php
<?php namespace Extendify\Tests\Integration; use Extendify\Shared\Services\Import\Post; use WP_UnitTestCase; class CronTest extends WP_UnitTestCase { public function test_cron_executes() { $isLocked = false; $cronUserId = null; $user = self::factory()->user->create(); wp_set_current_user($user); $postId = self::factory()->post->create(['post_content' => '<p>original</p>']); wp_set_post_lock($postId); // Cron runs as no user, so we need to reset the current user to 0 to simulate that. wp_set_current_user(0); add_action('my_cron_hook', function () use ($postId, &$isLocked, &$cronUserId) { $isLocked = wp_check_post_lock($postId); $cronUserId = get_current_user_id(); }); wp_schedule_single_event(time() - 10, 'my_cron_hook'); $crons = _get_cron_array(); foreach ($crons as $timestamp => $hooks) { if ($timestamp > time()) continue; foreach ($hooks as $hook => $events) { foreach ($events as $event) { do_action_ref_array($hook, $event['args']); } } } $this->assertTrue(Post::isLocked($postId)); $this->assertNotFalse(wp_check_post_lock($postId)); $this->assertNotNull($postId); $this->assertIsNumeric($isLocked); $this->assertSame($user, $isLocked); $this->assertSame(0, $cronUserId); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium56.web-hosting.com
Server IP: 198.54.119.70
PHP Version: 8.2.30
Server Software: LiteSpeed
System: Linux premium56.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 70.67 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: bkunreyz
User ID (UID): 830
Group ID (GID): 826
Script Owner UID: 830
Current Dir Owner: 830