!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/multirest.picotech.app/public_html/vendor/google/cloud-core/src/Testing/   drwxr-xr-x
Free 29.31 GB of 117.98 GB (24.85%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     TestHelpers.php (7.85 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

/**
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

namespace Google\Cloud\Core\Testing;

use 
Google\Cloud\Core\Testing\RegexFileFilter;
use 
Google\Cloud\Core\Testing\Snippet\Container;
use 
Google\Cloud\Core\Testing\Snippet\Coverage\Coverage;
use 
Google\Cloud\Core\Testing\Snippet\Coverage\Scanner;
use 
Google\Cloud\Core\Testing\Snippet\Parser\Parser;
use 
Google\Cloud\Core\Testing\System\SystemTestCase;

/**
 * Class TestHelpers is used to hold static functions required for testing
 *
 * @experimental
 * @internal
 */
class TestHelpers
{
    
/**
     * Create a test stub which extends a real class and allows overriding of private properties.
     *
     * @param string $extends The fully-qualified name of the class to extend.
     * @param array $args An array of constructor arguments to use when creating the stub.
     * @param array $props A list of private properties on which to enable overrriding.
     * @return mixed
     *
     * @experimental
     * @internal
     */
    
public static function stub($extends, array $args = [], array $props = [])
    {
        if (empty(
$props)) {
            
$props = ['connection'];
        }

        
$tpl 'class %s extends %s {private $___props = \'%s\'; use \Google\Cloud\Core\Testing\StubTrait; }';

        
$props json_encode($props);

        
$name 'Stub' sha1($extends $props);

        if (!
class_exists($name)) {
            eval(
sprintf($tpl$name$extends$props));
        }

        
$reflection = new \ReflectionClass($name);
        return 
$reflection->newInstanceArgs($args);
    }

    
/**
     * Get a trait implementation.
     *
     * @param string $trait The fully-qualified name of the trait to implement.
     * @return mixed
     *
     * @experimental
     * @internal
     */
    
public static function impl($trait, array $props = [])
    {
        
$properties = [];
        foreach (
$props as $prop) {
            
$properties[] = 'private $' $prop ';';
        }

        
$tpl 'class %s {
            use %s;
            use \Google\Cloud\Core\Testing\StubTrait;
            private $___props = \'%s\';
            %s
            public function call($fn, array $args = []) { return call_user_func_array([$this, $fn], $args); }
        }'
;

        
$name 'Trait' sha1($trait json_encode($props));

        if (!
class_exists($name)) {
            eval(
sprintf($tpl$name$traitjson_encode($props), implode("\n"$properties)));
        }

        return new 
$name;
    }

    
/**
     * Setup snippet tests support.
     *
     * @return void
     * @experimental
     * @internal
     */
    
public static function snippetBootstrap()
    {
        
putenv('GOOGLE_APPLICATION_CREDENTIALS='\Google\Cloud\Core\Testing\Snippet\Fixtures::KEYFILE_STUB_FIXTURE());

        
$parser = new Parser;
        
$scanner = new Scanner($parserself::projectRoot(), [
            
'/vendor/',
            
'/dev/',
            new 
RegexFileFilter('/\w{0,}\/vendor\//'),
            new 
RegexFileFilter('/\w{0,}\/V\d{1,}\//')
        ]);
        
$coverage = new Coverage($scanner);
        
$coverage->buildListToCover();

        
Container::$coverage $coverage;
        
Container::$parser $parser;
    }

    
/**
     * Setup performance tests support.
     *
     * @return void
     * @experimental
     * @internal
     */
    
public static function perfBootstrap()
    {
        
$bootstraps glob(self::projectRoot() .'/*/tests/Perf/bootstrap.php');
        foreach (
$bootstraps as $bootstrap) {
            require_once 
$bootstrap;
        }
    }

    
/**
     * Check that the required environment variable keyfile paths are set and exist.
     *
     * @param array|string $env The environment variable(s) required.
     * @throws \RuntimeException
     * @experimental
     * @internal
     */
    
public static function requireKeyfile($env)
    {
        
$env is_array($env) ? $env : [$env];

        foreach (
$env as $var) {
            if (!
getenv($var)) {
                throw new 
\RuntimeException(sprintf(
                    
'Please set the \'%s\' env var to run the tests',
                    
$var
                
));
            }

            
$path getenv($var);
            if (!
file_exists($path)) {
                throw new 
\RuntimeException(sprintf(
                    
'The path \`%s\` specified in environment variable `%s` does not exist.',
                    
$path,
                    
$var
                
));
            }
        }
    }

    
/**
     * Setup stuff needed for the system test runner.
     *
     * This method can only be called once per run. Subsequent calls will thrown \RuntimeException.
     *
     * @internal
     * @experimental
     */
    
public static function systemBootstrap()
    {
        static 
$started false;

        if (
$started) {
            throw new 
\RuntimeException('system tests cannot be bootstrapped more than once.');
        }

        
SystemTestCase::setupQueue();

        
$bootstraps glob(self::projectRoot() .'/*/tests/System/bootstrap.php');
        foreach (
$bootstraps as $bootstrap) {
            require_once 
$bootstrap;
        }

        
// This should always be last.
        
self::systemTestShutdown(function () {
            
SystemTestCase::processQueue();
        });

        
$started true;
    }

    
/**
     * Setup stuff needed for the generated system tests.
     * @internal
     * @experimental
     */
    
public static function generatedSystemTestBootstrap()
    {
        
// For generated system tests, we need to set GOOGLE_APPLICATION_CREDENTIALS
        // and PROJECT_ID to appropriate values
        
$keyFilePath getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH');
        
putenv("GOOGLE_APPLICATION_CREDENTIALS=$keyFilePath");
        
$keyFileData json_decode(file_get_contents($keyFilePath), true);
        
putenv('PROJECT_ID=' $keyFileData['project_id']);

    }

    
/**
     * Add cleanup function for system tests.
     *
     * Calls to this method enqueue a PHP shutdown function, scoped to the parent
     * PID.
     *
     * @param callable $shutdown The shutdown function.
     * @return void
     * @experimental
     * @internal
     */
    
public static function systemTestShutdown(callable $shutdown)
    {
        
$pid getmypid();
        
register_shutdown_function(function () use ($pid$shutdown) {
            
// Skip flushing deletion queue if exiting a forked process.
            
if ($pid !== getmypid()) {
                return;
            }

            
$shutdown();
        });
    }

    
/**
     * Get the value of a private property.
     *
     * @param mixed $class The class
     * @param string $property The property name.
     * @return mixed
     */
    
public static function getPrivateProperty($class$property)
    {
        
$className get_class($class);
        
$c \Closure::bind(function ($class) use ($property) {
            return 
$class->$property;
        }, 
null$className);

        return 
$c($class);
    }

    
/**
     * Determine the path of the project root based on where the composer
     * autoloader is located.
     *
     * @return string
     * @experimental
     * @internal
     */
    
private static function projectRoot()
    {
        static 
$projectRoot;

        if (!
$projectRoot) {
            
$ref = new \ReflectionClass(\Composer\Autoload\ClassLoader::class);
            
$projectRoot dirname(dirname(dirname($ref->getFileName())));
        }

        return 
$projectRoot;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0038 ]--