#!/usr/local/cpanel/3rdparty/bin/perl -w

#                                      Copyright 2025 WebPros International, LLC
#                                                            All rights reserved.
# copyright@cpanel.net                                          http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited.

use cPstrict;
use Test::Cpanel::Policy;

use Test2::V0;
use Test2::Plugin::NoWarnings;

use Test::MockFile;

use Cpanel::Admin::Modules::Cpanel::plugin_method_cache;

use base qw(Test::Class);

__PACKAGE__->new()->runtests() if !caller;

sub test_GET_SAVE_CACHE : Tests(1) {

    my $expected_cache = {
        'Cpanel::Plugins::Promotions::test_module' => {
            'test_method' => {
                'data' => 1,
                'time' => 8675309,
            }
        }
    };

    my $mock_cache_file = Test::MockFile->file( Cpanel::Admin::Modules::Cpanel::plugin_method_cache::cache_file(), '' );

    Cpanel::Admin::Modules::Cpanel::plugin_method_cache->SAVE_CACHE($expected_cache);

    is( Cpanel::Admin::Modules::Cpanel::plugin_method_cache::GET_CACHE(), $expected_cache, "Got the expected data from cache" );

    return;
}

1;
