Moved old tests
This commit is contained in:
parent
e93fd81002
commit
b751b39548
12 changed files with 33 additions and 13 deletions
32
tests/old_tests/autoload.php
Normal file
32
tests/old_tests/autoload.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright (c) Nosial 2022-2023, all rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
* associated documentation files (the "Software"), to deal in the Software without restriction, including without
|
||||
* limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||
* Software, and to permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
$BuildDirectory = __DIR__ . DIRECTORY_SEPARATOR . 'ncc' . DIRECTORY_SEPARATOR . 'build';
|
||||
$AutoloadPath = $BuildDirectory . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||
|
||||
if(!file_exists($BuildDirectory) || !is_dir($BuildDirectory))
|
||||
throw new RuntimeExcepion('Build directory does not exist, to run tests you must build the project.');
|
||||
|
||||
if(!file($AutoloadPath) || !is_file($AutoloadPath))
|
||||
throw new RuntimeException('Autoload file does not exist in \'' . $BuildDirectory .'\', to run tests you must build the project.');
|
||||
|
||||
require($AutoloadPath);
|
6
tests/old_tests/composer/parse_json.php
Normal file
6
tests/old_tests/composer/parse_json.php
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
require(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php');
|
||||
|
||||
$example = \ncc\Utilities\IO::fread(__DIR__ . DIRECTORY_SEPARATOR . 'json_example.json');
|
||||
var_dump(\ncc\Objects\ComposerJson::fromArray(json_decode($example, true)));
|
5
tests/old_tests/example_project/scripts/unit.php
Normal file
5
tests/old_tests/example_project/scripts/unit.php
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
echo 'Hello World!' . PHP_EOL;
|
||||
echo 'What is your name? ';
|
||||
$name = trim(fgets(STDIN));
|
||||
echo "Hello $name" . PHP_EOL;
|
9
tests/old_tests/package_lock/load_package_lock.php
Normal file
9
tests/old_tests/package_lock/load_package_lock.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
require(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php');
|
||||
|
||||
\ncc\ncc::initialize();
|
||||
$package_lock_manager = new \ncc\Managers\PackageLockManager();
|
||||
$package_lock_manager->load();
|
||||
|
||||
var_dump($package_lock_manager->getPackageLock());
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
require(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php');
|
||||
|
||||
$object = \ncc\Objects\ProjectConfiguration::fromFile(__DIR__ . DIRECTORY_SEPARATOR . 'project.json');
|
||||
|
||||
var_dump($object);
|
9
tests/old_tests/third_party/php-encryption/create_random_key.php
vendored
Normal file
9
tests/old_tests/third_party/php-encryption/create_random_key.php
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
require(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php');
|
||||
|
||||
print('Generating new random key' . PHP_EOL);
|
||||
$key = \ncc\Defuse\Crypto\Key::createNewRandomKey();
|
||||
$ascii_key = $key->saveToAsciiSafeString();
|
||||
|
||||
print('Key: ' . $ascii_key . PHP_EOL);
|
28
tests/old_tests/third_party/php-encryption/encryption_decryption.php
vendored
Normal file
28
tests/old_tests/third_party/php-encryption/encryption_decryption.php
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
require(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php');
|
||||
|
||||
print('Generating new random key' . PHP_EOL);
|
||||
$key = \ncc\Defuse\Crypto\Key::createNewRandomKey();
|
||||
$ascii_key = $key->saveToAsciiSafeString();
|
||||
|
||||
print('Key: ' . $ascii_key . PHP_EOL);
|
||||
|
||||
|
||||
print('Encrypting message \'Hello NCC!\' as raw binary' . PHP_EOL);
|
||||
$encrypted_message = \ncc\Defuse\Crypto\Crypto::encrypt('Hello NCC!', $key, true);
|
||||
print('Encrypted Message: ' . $encrypted_message . PHP_EOL);
|
||||
|
||||
|
||||
print('Decrypting message' . PHP_EOL);
|
||||
$decrypted_message = \ncc\Defuse\Crypto\Crypto::decrypt($encrypted_message, $key, true);
|
||||
print('Decrypted Message: ' . $decrypted_message . PHP_EOL);
|
||||
|
||||
if(hash('md5', 'Hello NCC!') == hash('md5', $decrypted_message))
|
||||
{
|
||||
print('Encryption/Decryption test successful' . PHP_EOL);
|
||||
}
|
||||
else
|
||||
{
|
||||
print('Encryption/Decryption test fail' . PHP_EOL);
|
||||
}
|
13
tests/old_tests/third_party/theseer/directory_scanner.php
vendored
Normal file
13
tests/old_tests/third_party/theseer/directory_scanner.php
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
require(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php');
|
||||
|
||||
$Scanner = new \ncc\ThirdParty\theseer\DirectoryScanner\DirectoryScanner();
|
||||
$Basedir = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'third_party');
|
||||
|
||||
/** @var SplFileInfo $item */
|
||||
foreach($Scanner($Basedir . DIRECTORY_SEPARATOR . 'src', true) as $item)
|
||||
{
|
||||
var_dump($item->getPath());
|
||||
var_dump($item);
|
||||
}
|
75
tests/old_tests/utils/pathfinder.php
Normal file
75
tests/old_tests/utils/pathfinder.php
Normal file
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
require(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php');
|
||||
|
||||
print('Unix Root Directory: ' . \ncc\Utilities\PathFinder::getRootPath(false) . PHP_EOL);
|
||||
print('Win32 Root Directory: ' . \ncc\Utilities\PathFinder::getRootPath(true) . PHP_EOL);
|
||||
print(PHP_EOL);
|
||||
|
||||
print('Unix Home Directory (Auto): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL);
|
||||
print('Unix Home Directory (User): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Enums\Scopes::USER, false) . PHP_EOL);
|
||||
print('Unix Home Directory (System): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL);
|
||||
print('Win32 Home Directory (Auto): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL);
|
||||
print('Win32 Home Directory (User): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Enums\Scopes::USER, true) . PHP_EOL);
|
||||
print('Win32 Home Directory (System): ' . \ncc\Utilities\PathFinder::getHomePath(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL);
|
||||
print(PHP_EOL);
|
||||
|
||||
print('Unix Data Directory (Auto): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL);
|
||||
print('Unix Data Directory (User): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Enums\Scopes::USER, false) . PHP_EOL);
|
||||
print('Unix Data Directory (System): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL);
|
||||
print('Win32 Data Directory (Auto): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL);
|
||||
print('Win32 Data Directory (User): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Enums\Scopes::USER, true) . PHP_EOL);
|
||||
print('Win32 Data Directory (System): ' . \ncc\Utilities\PathFinder::getDataPath(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL);
|
||||
print(PHP_EOL);
|
||||
|
||||
print('Unix Packages Directory (Auto): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL);
|
||||
print('Unix Packages Directory (User): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Enums\Scopes::USER, false) . PHP_EOL);
|
||||
print('Unix Packages Directory (System): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL);
|
||||
print('Win32 Packages Directory (Auto): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL);
|
||||
print('Win32 Packages Directory (User): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Enums\Scopes::USER, true) . PHP_EOL);
|
||||
print('Win32 Packages Directory (System): ' . \ncc\Utilities\PathFinder::getPackagesPath(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL);
|
||||
print(PHP_EOL);
|
||||
|
||||
print('Unix Cache Directory (Auto): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL);
|
||||
print('Unix Cache Directory (User): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Enums\Scopes::USER, false) . PHP_EOL);
|
||||
print('Unix Cache Directory (System): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL);
|
||||
print('Win32 Cache Directory (Auto): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL);
|
||||
print('Win32 Cache Directory (User): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Enums\Scopes::USER, true) . PHP_EOL);
|
||||
print('Win32 Cache Directory (System): ' . \ncc\Utilities\PathFinder::getCachePath(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL);
|
||||
print(PHP_EOL);
|
||||
|
||||
print('Unix Tmp Directory (Auto): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL);
|
||||
print('Unix Tmp Directory (User): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Enums\Scopes::USER, false) . PHP_EOL);
|
||||
print('Unix Tmp Directory (System): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL);
|
||||
print('Win32 Tmp Directory (Auto): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL);
|
||||
print('Win32 Tmp Directory (User): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Enums\Scopes::USER, true) . PHP_EOL);
|
||||
print('Win32 Tmp Directory (System): ' . \ncc\Utilities\PathFinder::getTmpPath(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL);
|
||||
print(PHP_EOL);
|
||||
|
||||
print('Unix Extension Directory (Auto): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL);
|
||||
print('Unix Extension Directory (User): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Enums\Scopes::USER, false) . PHP_EOL);
|
||||
print('Unix Extension Directory (System): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL);
|
||||
print('Win32 Extension Directory (Auto): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL);
|
||||
print('Win32 Extension Directory (User): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Enums\Scopes::USER, true) . PHP_EOL);
|
||||
print('Win32 Extension Directory (System): ' . \ncc\Utilities\PathFinder::getExtensionPath(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL);
|
||||
print(PHP_EOL);
|
||||
|
||||
print('Unix Configuration File (Auto): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL);
|
||||
print('Unix Configuration File (User): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Enums\Scopes::USER, false) . PHP_EOL);
|
||||
print('Unix Configuration File (System): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL);
|
||||
print('Unix Configuration File(s): ' . json_encode(\ncc\Utilities\PathFinder::getConfigurationFiles(false), JSON_UNESCAPED_SLASHES) . PHP_EOL);
|
||||
print('Win32 Configuration File (Auto): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL);
|
||||
print('Win32 Configuration File (User): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Enums\Scopes::USER, true) . PHP_EOL);
|
||||
print('Win32 Configuration File (System): ' . \ncc\Utilities\PathFinder::getConfigurationFile(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL);
|
||||
print('Win32 Configuration File(s): ' . json_encode(\ncc\Utilities\PathFinder::getConfigurationFiles(true), JSON_UNESCAPED_SLASHES) . PHP_EOL);
|
||||
print(PHP_EOL);
|
||||
|
||||
print('Unix Package Lock (Auto): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Enums\Scopes::AUTO, false) . PHP_EOL);
|
||||
print('Unix Package Lock (User): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Enums\Scopes::USER, false) . PHP_EOL);
|
||||
print('Unix Package Lock (System): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Enums\Scopes::SYSTEM, false) . PHP_EOL);
|
||||
print('Unix Package Lock(s): ' . json_encode(\ncc\Utilities\PathFinder::getPackageLockFiles(false), JSON_UNESCAPED_SLASHES) . PHP_EOL);
|
||||
print('Win32 Package Lock (Auto): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Enums\Scopes::AUTO, true) . PHP_EOL);
|
||||
print('Win32 Package Lock (User): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Enums\Scopes::USER, true) . PHP_EOL);
|
||||
print('Win32 Package Lock (System): ' . \ncc\Utilities\PathFinder::getPackageLock(\ncc\Enums\Scopes::SYSTEM, true) . PHP_EOL);
|
||||
print('Win32 Package Lock(s): ' . json_encode(\ncc\Utilities\PathFinder::getPackageLockFiles(true), JSON_UNESCAPED_SLASHES) . PHP_EOL);
|
||||
print(PHP_EOL);
|
5
tests/old_tests/utils/runtime_extensions.php
Normal file
5
tests/old_tests/utils/runtime_extensions.php
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
require(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php');
|
||||
|
||||
var_dump(\ncc\Utilities\Validate::requiredExtensions());
|
5
tests/old_tests/utils/scope_resolver.php
Normal file
5
tests/old_tests/utils/scope_resolver.php
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
require(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php');
|
||||
|
||||
print('Detected Scope: ' . \ncc\Utilities\Resolver::resolveScope() . PHP_EOL);
|
Loading…
Add table
Add a link
Reference in a new issue