<?php
namespace Illuminate\Testing;
use Illuminate\Contracts\Container\Container;
use Illuminate\Support\Str;
class ParallelTesting
{
/**
* The container instance.
*
* @var \Illuminate\Contracts\Container\Container
*/
protected $container;
/**
* The options resolver callback.
*
* @var \Closure|null
*/
protected $optionsResolver;
/**
* The token resolver callback.
*
* @var \Closure|null
*/
protected $tokenResolver;
/**
* All of the registered "setUp" process callbacks.
*
* @var array
*/
protected $setUpProcessCallbacks = [];
/**
* All of the registered "setUp" test case callbacks.
*
* @var array
*/
protected $setUpTestCaseCallbacks = [];
/**
* All of the registered "setUp" test database callbacks.
*
* @var array
*/
protected $setUpTestDatabaseCallbacks = [];
/**
* All of the registered "tearDown" process callbacks.
*
* @var array
*/
protected $tearDownProcessCallbacks = [];
/**
* All of the registered "tearDown" test case callbacks.
*
* @var array
*/
protected $tearDownTestCaseCallbacks = [];
/**
* Create a new parallel testing instance.
*
* @param \Illuminate\Contracts\Container\Container $container
* @return void
*/
public function __construct(Container $container)
{
$this->container = $container;
}
/**
* Set a callback that should be used when resolving options.
*
* @param \Closure|null $resolver
* @return void
*/
public function resolveOptionsUsing($resolver)
{
$this->optionsResolver = $resolver;
}
/**
* Set a callback that should be used when resolving the unique process token.
*
* @param \Closure|null $resolver
* @return void
*/
public function resolveTokenUsing($resolver)
{
$this->tokenResolver = $resolver;
}
/**
* Register a "setUp" process callback.
*
* @param callable $callback
* @return void
*/
public function setUpProcess($callback)
{
$this->setUpProcessCallbacks[] = $callback;
}
/**
* Register a "setUp" test case callback.
*
* @param callable $callback
* @return void
*/
public function setUpTestCase($callback)
{
$this->setUpTestCaseCallbacks[] = $callback;
}
/**
* Register a "setUp" test database callback.
*
* @param callable $callback
* @return void
*/
public function setUpTestDatabase($callback)
{
$this->setUpTestDatabaseCallbacks[] = $callback;
}
/**
* Register a "tearDown" process callback.
*
* @param callable $callback
* @return void
*/
public function tearDownProcess($callback)
{
$this->tearDownProcessCallbacks[] = $callback;
}
/**
* Register a "tearDown" test case callback.
*
* @param callable $callback
* @return void
*/
public function tearDownTestCase($callback)
{
$this->tearDownTestCaseCallbacks[] = $callback;
}
/**
* Call all of the "setUp" process callbacks.
*
* @return void
*/
public function callSetUpProcessCallbacks()
{
$this->whenRunningInParallel(function () {
foreach ($this->setUpProcessCallbacks as $callback) {
$this->container->call($callback, [
'token' => $this->token(),
]);
}
});
}
/**
* Call all of the "setUp" test case callbacks.
*
* @param \Illuminate\Foundation\Testing\TestCase $testCase
* @return void
*/
public function callSetUpTestCaseCallbacks($testCase)
{
$this->whenRunningInParallel(function () use ($testCase) {
foreach ($this->setUpTestCaseCallbacks as $callback) {
$this->container->call($callback, [
'testCase' => $testCase,
'token' => $this->token(),
]);
}
});
}
/**
* Call all of the "setUp" test database callbacks.
*
* @param string $database
* @return void
*/
public function callSetUpTestDatabaseCallbacks($database)
{
$this->whenRunningInParallel(function () use ($database) {
foreach ($this->setUpTestDatabaseCallbacks as $callback) {
$this->container->call($callback, [
'database' => $database,
'token' => $this->token(),
]);
}
});
}
/**
* Call all of the "tearDown" process callbacks.
*
* @return void
*/
public function callTearDownProcessCallbacks()
{
$this->whenRunningInParallel(function () {
foreach ($this->tearDownProcessCallbacks as $callback) {
$this->container->call($callback, [
'token' => $this->token(),
]);
}
});
}
/**
* Call all of the "tearDown" test case callbacks.
*
* @param \Illuminate\Foundation\Testing\TestCase $testCase
* @return void
*/
public function callTearDownTestCaseCallbacks($testCase)
{
$this->whenRunningInParallel(function () use ($testCase) {
foreach ($this->tearDownTestCaseCallbacks as $callback) {
$this->container->call($callback, [
'testCase' => $testCase,
'token' => $this->token(),
]);
}
});
}
/**
* Get a parallel testing option.
*
* @param string $option
* @return mixed
*/
public function option($option)
{
$optionsResolver = $this->optionsResolver ?: function ($option) {
$option = 'LARAVEL_PARALLEL_TESTING_'.Str::upper($option);
return $_SERVER[$option] ?? false;
};
return $optionsResolver($option);
}
/**
* Gets a unique test token.
*
* @return string|false
*/
public function token()
{
return $this->tokenResolver
? call_user_func($this->tokenResolver)
: ($_SERVER['TEST_TOKEN'] ?? false);
}
/**
* Apply the callback if tests are running in parallel.
*
* @param callable $callback
* @return void
*/
protected function whenRunningInParallel($callback)
{
if ($this->inParallel()) {
$callback();
}
}
/**
* Indicates if the current tests are been run in parallel.
*
* @return bool
*/
protected function inParallel()
{
return ! empty($_SERVER['LARAVEL_PARALLEL_TESTING']) && $this->token();
}
}
At NFC Pay, we strive to provide a seamless and satisfactory experience with our services. This Refund Policy outlines the circumstances under which refunds may be issued for transactions made through our platform. Please read this policy carefully to understand your rights regarding refunds.
1. Eligibility for Refunds
Refunds may be considered under the following circumstances:
2. Non-Refundable Situations
Refunds will generally not be issued in the following situations:
3. Refund Process
To request a refund, please follow these steps:
4. Refund Exceptions
Certain transactions may be subject to specific terms and conditions, including non-refundable fees or charges. Please review the terms associated with each transaction carefully, as some fees may not be eligible for refunds.
5. Modifications to the Refund Policy
NFC Pay reserves the right to modify this Refund Policy at any time. Changes will be communicated through updates on our website and app, and the effective date will be updated accordingly. We encourage you to review this policy periodically to stay informed about our refund practices.
By using NFC Pay, you agree to this Refund Policy and understand the terms under which refunds may be issued. Our goal is to ensure a fair and transparent refund process, providing you with confidence and peace of mind when using our services.