allow vendord
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
This commit is contained in:
103
vendor/laravel/socialite/src/Testing/FakeProvider.php
vendored
Normal file
103
vendor/laravel/socialite/src/Testing/FakeProvider.php
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Socialite\Testing;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Traits\ForwardsCalls;
|
||||
use Laravel\Socialite\Contracts\Provider;
|
||||
|
||||
class FakeProvider implements Provider
|
||||
{
|
||||
use ForwardsCalls;
|
||||
|
||||
/**
|
||||
* The driver name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $driver;
|
||||
|
||||
/**
|
||||
* The provider resolver.
|
||||
*
|
||||
* @var \Closure
|
||||
*/
|
||||
protected $resolver;
|
||||
|
||||
/**
|
||||
* The original provider instance.
|
||||
*
|
||||
* @var \Laravel\Socialite\Contracts\Provider
|
||||
*/
|
||||
protected $provider;
|
||||
|
||||
/**
|
||||
* The fake user to return.
|
||||
*
|
||||
* @var \Laravel\Socialite\Contracts\User|\Closure|array|null
|
||||
*/
|
||||
protected $user = null;
|
||||
|
||||
/**
|
||||
* Create a new fake provider instance.
|
||||
*
|
||||
* @param string $driver
|
||||
* @param \Closure $resolver
|
||||
* @param \Laravel\Socialite\Contracts\User|\Closure|array|null $user
|
||||
*/
|
||||
public function __construct($driver, $resolver, $user = null)
|
||||
{
|
||||
$this->driver = $driver;
|
||||
$this->resolver = $resolver;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect the user to the authentication page for the provider.
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function redirect()
|
||||
{
|
||||
return new RedirectResponse('https://socialite.fake/'.$this->driver.'/authorize');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the User instance for the authenticated user.
|
||||
*
|
||||
* @return \Laravel\Socialite\Contracts\User
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
if ($this->user instanceof Closure) {
|
||||
return ($this->user)();
|
||||
}
|
||||
|
||||
return $this->user ?? $this->provider()->user();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the original provider instance.
|
||||
*
|
||||
* @return \Laravel\Socialite\Contracts\Provider
|
||||
*/
|
||||
public function provider()
|
||||
{
|
||||
if (isset($this->provider)) {
|
||||
return $this->provider;
|
||||
}
|
||||
|
||||
return $this->provider = ($this->resolver)();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle calls to methods that are not available on the fake provider.
|
||||
*
|
||||
* @param string $method
|
||||
*/
|
||||
public function __call($method, array $parameters)
|
||||
{
|
||||
return $this->forwardCallTo($this->provider(), $method, $parameters);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user