prefix
stringlengths
512
512
suffix
stringlengths
256
256
middle
stringlengths
14
229
meta
dict
ndation\Application; use Illuminate\Redis\RedisManager; use Mockery as m; use PHPUnit\Framework\TestCase; class RedisManagerExtensionTest extends TestCase { /** * @var \Illuminate\Redis\RedisManager */ protected $redis; protected function setUp(): void { parent::setUp(); $th...
some-port', 'database' => 5, 'timeout' => 0.5, ], ], ], ]); $this->redis->extend('my_custom_driver', function () { return new FakeR
tabase' => 5, 'timeout' => 0.5, ], 'clusters' => [ 'my-cluster' => [ [ 'host' => 'some-host', 'port' => '
{ "filepath": "tests/Redis/RedisManagerExtensionTest.php", "language": "php", "file_size": 3698, "cut_index": 614, "middle_length": 229 }
Connection; use Mockery as m; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use PHPUnit\Framework\TestCase; #[RequiresPhpExtension('redis')] class PhpRedisClusterConnectionTest extends TestCase { public function testItScansUsingDefaultNode() { $client = m::mock(\RedisCluster::class); $...
{ $client = m::mock(\RedisCluster::class); $client->shouldReceive('_masters')->once()->andReturn([['127.0.0.1', '6379']]); $client->shouldReceive('scan')->twice(); $connection = new PhpRedisClusterConnection($client);
->andReturn(['key']); $connection = new PhpRedisClusterConnection($client); $this->assertEquals([0, ['key']], $connection->scan(0)); } public function testItOnlyFetchesDefaultNodeOnce()
{ "filepath": "tests/Redis/Connections/PhpRedisClusterConnectionTest.php", "language": "php", "file_size": 3567, "cut_index": 614, "middle_length": 229 }
Illuminate\Foundation\AliasLoader; use PHPUnit\Framework\TestCase; class FoundationAliasLoaderTest extends TestCase { public function setUp(): void { parent::setUp(); AliasLoader::setInstance(null); AliasLoader::setFacadeNamespace('Facades\\'); } public function testLoaderCanB...
=> 'bar']); $this->assertSame($loader, AliasLoader::getInstance()); } public function testLoaderCanBeCreatedAndRegisteredMergingAliases() { $loader = AliasLoader::getInstance(['foo' => 'bar']); $this->assertEquals(['foo
e($loader->isRegistered()); $loader->register(); $this->assertTrue($loader->isRegistered()); } public function testGetInstanceCreatesOneInstance() { $loader = AliasLoader::getInstance(['foo'
{ "filepath": "tests/Foundation/FoundationAliasLoaderTest.php", "language": "php", "file_size": 2285, "cut_index": 563, "middle_length": 229 }
act; use Illuminate\Foundation\Application; use Illuminate\Foundation\Http\Kernel as HttpKernel; use Illuminate\Http\Middleware\PrefersJsonResponses; use PHPUnit\Framework\TestCase; class FoundationApplicationBuilderTest extends TestCase { protected function tearDown(): void { unset($_ENV['APP_BASE_PAT...
APP_BASE_PATH'] = __DIR__.'/as-env'; $app = Application::configure()->create(); $this->assertSame(__DIR__.'/as-env', $app->basePath()); } public function testBaseDirectoryWithComposer() { $app = Application::configure
__DIR__.'/as-env'; $app = Application::configure(__DIR__.'/as-arg')->create(); $this->assertSame(__DIR__.'/as-arg', $app->basePath()); } public function testBaseDirectoryWithEnv() { $_ENV['
{ "filepath": "tests/Foundation/FoundationApplicationBuilderTest.php", "language": "php", "file_size": 4683, "cut_index": 614, "middle_length": 229 }
$config->shouldReceive('set')->once()->with('app.locale', 'foo'); $app['translator'] = $trans = m::mock(stdClass::class); $trans->shouldReceive('setLocale')->once()->with('foo'); $app['events'] = $events = m::mock(stdClass::class); $events->shouldReceive('dispatch')->once()->with(m::on(f...
w Application; $app->register($provider); $this->assertArrayHasKey($class, $app->getLoadedProviders()); } public function testClassesAreBoundWhenServiceProviderIsRegistered() { $app = new Application; $app->reg
erviceProvidersAreCorrectlyRegistered() { $provider = m::mock(ApplicationBasicServiceProviderStub::class); $class = get_class($provider); $provider->shouldReceive('register')->once(); $app = ne
{ "filepath": "tests/Foundation/FoundationApplicationTest.php", "language": "php", "file_size": 28616, "cut_index": 1331, "middle_length": 229 }
ts\Auth\Authenticatable; use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\UserProvider; use Illuminate\Foundation\Application; use Illuminate\Foundation\Testing\Concerns\InteractsWithAuthentication; use Mockery as m; use PHPUnit\Framework\TestCase; class FoundationAuthenticationTest extends TestCase ...
uard = m::mock(Guard::class); $auth = m::mock(AuthManager::class); $auth->shouldReceive('guard') ->once() ->andReturn($guard); $this->app = m::mock(Application::class); $this->app->shouldReceive('ma
aravel.com', 'password' => 'secret_password', ]; /** * @return \Illuminate\Contracts\Auth\Guard|\Mockery\LegacyMockInterface|\Mockery\MockInterface */ protected function mockGuard() { $g
{ "filepath": "tests/Foundation/FoundationAuthenticationTest.php", "language": "php", "file_size": 3149, "cut_index": 614, "middle_length": 229 }
use Illuminate\Contracts\Auth\Access\Gate as GateContract; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use PHPUnit\Framework\TestCase; class FoundationAuthorizesRequestsTraitTest extends TestCase { protected function tearDown(): void { Container::setInstance(null); parent::tearDo...
sponse); $this->assertTrue($_SERVER['_test.authorizes.trait']); } public function testAcceptsBackedEnumAsAbility() { unset($_SERVER['_test.authorizes.trait.enum']); $gate = $this->getBasicGate(); $gate->define
{ $_SERVER['_test.authorizes.trait'] = true; return true; }); $response = (new FoundationTestAuthorizeTraitClass)->authorize('baz'); $this->assertInstanceOf(Response::class, $re
{ "filepath": "tests/Foundation/FoundationAuthorizesRequestsTraitTest.php", "language": "php", "file_size": 5207, "cut_index": 716, "middle_length": 229 }
Illuminate\Contracts\Cache\Factory; use Illuminate\Contracts\Cache\Repository; use Illuminate\Foundation\CacheBasedMaintenanceMode; use Mockery as m; use PHPUnit\Framework\TestCase; class FoundationCacheBasedMaintenanceModeTest extends TestCase { public function test_it_determines_whether_maintenance_mode_is_activ...
True(); $this->assertTrue($manager->active()); } public function test_it_retrieves_payload_from_cache() { $cache = m::mock(Factory::class, Repository::class); $cache->shouldReceive('store')->with('store-key')->andReturn
Mode($cache, 'store-key', 'key'); $cache->shouldReceive('has')->once()->with('key')->andReturnFalse(); $this->assertFalse($manager->active()); $cache->shouldReceive('has')->once()->with('key')->andReturn
{ "filepath": "tests/Foundation/FoundationCacheBasedMaintenanceModeTest.php", "language": "php", "file_size": 2071, "cut_index": 563, "middle_length": 229 }
string|null */ protected $openedUrl; /** * The command registered to the container. * * @var \Illuminate\Foundation\Console\DocsCommand */ protected $command; protected function setUp(): void { parent::setUp(); Http::preventStrayRequests()->fake([ ...
Documentation(): void { $this->artisan('docs') ->expectsQuestion('Which page would you like to open?', '') ->expectsOutputToContain('Opening the docs to: https://laravel.com/docs/8.x/installation') ->assertSu
d()); } protected function tearDown(): void { putenv('ARTISAN_DOCS_ASK_STRATEGY'); putenv('ARTISAN_DOCS_OPEN_STRATEGY'); parent::tearDown(); } public function testItCanOpenTheLaravel
{ "filepath": "tests/Foundation/FoundationDocsCommandTest.php", "language": "php", "file_size": 12914, "cut_index": 921, "middle_length": 229 }
Illuminate\Foundation\EnvironmentDetector; use PHPUnit\Framework\TestCase; class FoundationEnvironmentDetectorTest extends TestCase { public function testClosureCanBeUsedForCustomEnvironmentDetection() { $env = new EnvironmentDetector; $result = $env->detect(function () { return 'f...
new EnvironmentDetector; $result = $env->detect(function () { return 'foobar'; }, ['--env', 'local']); $this->assertSame('local', $result); } public function testConsoleEnvironmentDetectionWithNoValue() {
$env->detect(function () { return 'foobar'; }, ['--env=local']); $this->assertSame('local', $result); } public function testConsoleEnvironmentDetectionSeparatedWithSpace() { $env =
{ "filepath": "tests/Foundation/FoundationEnvironmentDetectorTest.php", "language": "php", "file_size": 2155, "cut_index": 563, "middle_length": 229 }
{ use InteractsWithExceptionHandling; protected $config; protected $viewFactory; protected $container; protected $handler; protected $request; protected function setUp(): void { $this->config = m::mock(Config::class); $this->viewFactory = m::mock(ViewFactory::class...
)); $this->handler = new Handler($this->container); } protected function tearDown(): void { Container::setInstance(null); parent::tearDown(); } public function testHandlerReportsExceptionAsContext()
$this->container->instance(ViewFactory::class, $this->viewFactory); $this->container->instance(ResponseFactoryContract::class, new ResponseFactory( $this->viewFactory, m::mock(Redirector::class)
{ "filepath": "tests/Foundation/FoundationExceptionsHandlerTest.php", "language": "php", "file_size": 35485, "cut_index": 2151, "middle_length": 229 }
Case { public function testGetReturnsNullWhenNotFound() { $redis = $this->getRedis(); $redis->getRedis()->shouldReceive('connection')->once()->with('default')->andReturn($redis->getRedis()); $redis->getRedis()->shouldReceive('get')->once()->with('prefix:foo')->andReturn(null); $t...
lic function testRedisMultipleValuesAreReturned() { $redis = $this->getRedis(); $redis->getRedis()->shouldReceive('connection')->once()->with('default')->andReturn($redis->getRedis()); $redis->getRedis()->shouldReceive('mget')->
ce()->with('default')->andReturn($redis->getRedis()); $redis->getRedis()->shouldReceive('get')->once()->with('prefix:foo')->andReturn(serialize('foo')); $this->assertSame('foo', $redis->get('foo')); } pub
{ "filepath": "tests/Cache/CacheRedisStoreTest.php", "language": "php", "file_size": 6892, "cut_index": 716, "middle_length": 229 }
lass; class CacheRepositoryTest extends TestCase { protected function setUp(): void { parent::setUp(); Carbon::setTestNow(Carbon::parse(self::getTestDate())); } protected function tearDown(): void { Carbon::setTestNow(); Repository::handleUnserializableClassUsing(n...
o->getStore()->shouldReceive('many')->once()->with(['foo', 'bar'])->andReturn(['foo' => 'bar', 'bar' => 'baz']); $this->assertEquals(['foo' => 'bar', 'bar' => 'baz'], $repo->get(['foo', 'bar'])); } public function testGetReturnsMultipleVal
()->with('foo')->andReturn('bar'); $this->assertSame('bar', $repo->get('foo')); } public function testGetReturnsMultipleValuesFromCacheWhenGivenAnArray() { $repo = $this->getRepository(); $rep
{ "filepath": "tests/Cache/CacheRepositoryTest.php", "language": "php", "file_size": 28947, "cut_index": 1331, "middle_length": 229 }
TestCase; use stdClass; class CacheSessionStoreTest extends TestCase { protected function tearDown(): void { Carbon::setTestNow(); parent::tearDown(); } public function testItemsCanBeSetAndRetrieved() { $store = new SessionStore(self::getSession()); $result = $stor...
seconds $this->assertSame('world', $store->get('hello')); Carbon::setTestNow('2000-01-01 00:00:01.500'); // progress 0.001 seconds. 1 second since putting into cache. $this->assertNull($store->get('hello')); } public func
essionStore(self::getSession()); Carbon::setTestNow('2000-01-01 00:00:00.500'); // 500 milliseconds past $store->put('hello', 'world', 1); Carbon::setTestNow('2000-01-01 00:00:01.499'); // progress 0.999
{ "filepath": "tests/Cache/CacheSessionStoreTest.php", "language": "php", "file_size": 7703, "cut_index": 716, "middle_length": 229 }
n testCacheCanBeSavedWithMultipleTags() { $store = new ArrayStore; $tags = ['bop', 'zap']; $store->tags($tags)->put('foo', 'bar', 10); $this->assertSame('bar', $store->tags($tags)->get('foo')); } public function testCacheCanBeSetWithDatetimeArgument() { $store = ...
gs($tags1)->put('foo', 'bar', 10); $tags2 = ['bam', 'pow']; $store->tags($tags2)->put('foo', 'bar', 10); $store->tags('zap')->flush(); $this->assertNull($store->tags($tags1)->get('foo')); $this->assertSame('bar', $st
$this->assertSame('bar', $store->tags($tags)->get('foo')); } public function testCacheSavedWithMultipleTagsCanBeFlushed() { $store = new ArrayStore; $tags1 = ['bop', 'zap']; $store->ta
{ "filepath": "tests/Cache/CacheTaggedCacheTest.php", "language": "php", "file_size": 6426, "cut_index": 716, "middle_length": 229 }
eoutException; use Illuminate\Cache\Repository; use Illuminate\Contracts\Cache\LockProvider; use Illuminate\Contracts\Cache\Store; use PHPUnit\Framework\TestCase; use Throwable; class ConcurrencyLimiterTest extends TestCase { protected Repository $repository; protected function setUp(): void { par...
(new ConcurrencyLimiterMockThatDoesntRelease($this->repository->getStore(), 'key', 2, 5))->block(0, function () use (&$store) { $store[] = 3; }); } catch (Throwable $e) { $this->assertInstanceOf(
, 2) as $i) { (new ConcurrencyLimiterMockThatDoesntRelease($this->repository->getStore(), 'key', 2, 5))->block(2, function () use (&$store, $i) { $store[] = $i; }); } try {
{ "filepath": "tests/Cache/ConcurrencyLimiterTest.php", "language": "php", "file_size": 8270, "cut_index": 716, "middle_length": 229 }
inate\Cache\ArrayStore; use Illuminate\Cache\RateLimiter; use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Cache\Repository; use Illuminate\Contracts\Cache\Repository as Cache; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use ReflectionProperty; class RateLimiterTest extends Te...
erDataProvider')] public function testRegisterNamedRateLimiter(mixed $name, string $expected): void { $reflectedLimitersProperty = new ReflectionProperty(RateLimiter::class, 'limiters'); $rateLimiter = new RateLimiter($this->create
'uses UnitEnum' => [UnitEnumNamedRateLimiter::THIRD_PARTY, 'THIRD_PARTY'], 'uses normal string' => ['yolo', 'yolo'], 'uses int' => [100, '100'], ]; } #[DataProvider('registerNamedRateLimit
{ "filepath": "tests/Cache/RateLimiterTest.php", "language": "php", "file_size": 2692, "cut_index": 563, "middle_length": 229 }
RuleTest extends TestCase { /** * Setup the database schema. * * @return void */ protected function setUp(): void { $db = new DB; $db->addConnection([ 'driver' => 'sqlite', 'database' => ':memory:', ]); $db->bootEloquent(); ...
ing) $rule); $rule = new Exists(UserWithPrefixedTable::class); $rule->where('foo', 'bar'); $this->assertSame('exists:'.UserWithPrefixedTable::class.',NULL,foo,"bar"', (string) $rule); $rule = new Exists('table', 'column');
('foo', 'bar'); $this->assertSame('exists:table,NULL,foo,"bar"', (string) $rule); $rule = new Exists(User::class); $rule->where('foo', 'bar'); $this->assertSame('exists:users,NULL,foo,"bar"', (str
{ "filepath": "tests/Validation/ValidationExistsRuleTest.php", "language": "php", "file_size": 11446, "cut_index": 921, "middle_length": 229 }
er; use Mockery as m; use PHPUnit\Framework\TestCase; class CacheApcStoreTest extends TestCase { public function testGetReturnsNullWhenNotFound() { $apc = $this->getMockBuilder(ApcWrapper::class)->onlyMethods(['get'])->getMock(); $apc->expects($this->once())->method('get')->with('foobar')->will...
public function testAPCFalseValueIsReturned() { $apc = $this->getMockBuilder(ApcWrapper::class)->onlyMethods(['get'])->getMock(); $apc->expects($this->once())->method('get')->willReturn(false); $store = new ApcStore($apc);
Builder(ApcWrapper::class)->onlyMethods(['get'])->getMock(); $apc->expects($this->once())->method('get')->willReturn('bar'); $store = new ApcStore($apc); $this->assertSame('bar', $store->get('foo')); }
{ "filepath": "tests/Cache/CacheApcStoreTest.php", "language": "php", "file_size": 4993, "cut_index": 614, "middle_length": 229 }
$result = $store->put('foo', 'bar', 10); $this->assertTrue($result); $this->assertSame('bar', $store->get('foo')); } public function testCacheTtl(): void { $store = new ArrayStore(); Carbon::setTestNow('2000-01-01 00:00:00.500'); // 500 milliseconds past $store->put...
ew ArrayStore; $result = $store->put('foo', 'bar', 10); $resultMany = $store->putMany([ 'fizz' => 'buz', 'quz' => 'baz', ], 10); $this->assertTrue($result); $this->assertTrue($resultMany);
2000-01-01 00:00:01.500'); // progress 0.001 seconds. 1 second since putting into cache. $this->assertNull($store->get('hello')); } public function testMultipleItemsCanBeSetAndRetrieved() { $store = n
{ "filepath": "tests/Cache/CacheArrayStoreTest.php", "language": "php", "file_size": 11426, "cut_index": 921, "middle_length": 229 }
namespace Illuminate\Tests\Cache; use Aws\DynamoDb\DynamoDbClient; use Illuminate\Cache\DynamoDbStore; use PHPUnit\Framework\TestCase; class CacheDynamoDbStoreTest extends TestCase { public function testTouchMethodCorrectlyCallsDynamoDb(): void { $table = 'table'; $key = 'key'; $ttl =...
Expression'], 'SET') ); $this->assertTrue( $ttl === $dynamo->args['ExpressionAttributeValues'][':expiry']['N'] - $dynamo->args['ExpressionAttributeValues'][':now']['N'] ); } } class TestDynamo extends D
amo->args['TableName'], $dynamo->args['Key']['key']['S']) && $dynamo->args['TableName'] === $table && $dynamo->args['Key']['key']['S'] === $key && str_contains($dynamo->args['Update
{ "filepath": "tests/Cache/CacheDynamoDbStoreTest.php", "language": "php", "file_size": 1206, "cut_index": 518, "middle_length": 229 }
inate\Contracts\Cache\Store; use Illuminate\Events\Dispatcher; use Mockery as m; use PHPUnit\Framework\TestCase; class CacheEventsTest extends TestCase { public function testHasTriggersEvents() { $dispatcher = $this->getDispatcher(); $repository = $this->getRepository($dispatcher); $di...
EventMatches(RetrievingKey::class, ['storeName' => 'array', 'key' => 'baz'])); $dispatcher->shouldReceive('dispatch')->once()->with($this->assertEventMatches(CacheHit::class, ['storeName' => 'array', 'key' => 'baz', 'value' => 'qux'])); $th
ce()->with($this->assertEventMatches(CacheMissed::class, ['storeName' => 'array', 'key' => 'foo'])); $this->assertFalse($repository->has('foo')); $dispatcher->shouldReceive('dispatch')->once()->with($this->assert
{ "filepath": "tests/Cache/CacheEventsTest.php", "language": "php", "file_size": 20389, "cut_index": 1331, "middle_length": 229 }
eption; use Mockery as m; use PHPUnit\Framework\TestCase; use stdClass; class CacheManagerTest extends TestCase { public function testCustomDriverClosureBoundObjectIsCacheManager() { $manager = new CacheManager($this->getApp([ 'cache' => [ 'stores' => [ _...
__CLASS__ => [ 'driver' => __CLASS__, ], ], ], ])); $driver = new stdClass; $manager->extend(__CLASS__, static fn () => $driver);
$this->assertSame($manager, $manager->store(__CLASS__)); } public function testCustomDriverStaticClosure() { $manager = new CacheManager($this->getApp([ 'cache' => [ 'stores' => [
{ "filepath": "tests/Cache/CacheManagerTest.php", "language": "php", "file_size": 15003, "cut_index": 921, "middle_length": 229 }
use Illuminate\Contracts\Filesystem\Filesystem; class ArrayFilesystem implements Filesystem { public array $files = []; public function path($path) { return $path; } public function exists($path) { return array_key_exists($path, $this->files) || $this->files($path) !== []; ...
leAs($path, $file, $name = null, $options = []) { return false; } public function writeStream($path, $resource, array $options = []) { return false; } public function getVisibility($path) { return Files
h, $contents, $options = []) { $this->files[$path] = $contents; return true; } public function putFile($path, $file = null, $options = []) { return false; } public function putFi
{ "filepath": "tests/Cache/Fixtures/ArrayFilesystem.php", "language": "php", "file_size": 2889, "cut_index": 563, "middle_length": 229 }
ntracts\Support\Jsonable; use Illuminate\Http\JsonResponse; use InvalidArgumentException; use JsonSerializable; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use stdClass; class HttpJsonResponseTest extends TestCase { #[DataProvider('setAndRetrieveDataProvider')] public functio...
esponseTestJsonSerializeObject], 'Arrayable data' => [new JsonResponseTestArrayableObject], 'Array data' => [['foo' => 'bar']], 'stdClass data' => [(object) ['foo' => 'bar']], ]; } public function testGe
sponse->getData()->foo); } public static function setAndRetrieveDataProvider() { return [ 'Jsonable data' => [new JsonResponseTestJsonableObject], 'JsonSerializable data' => [new JsonR
{ "filepath": "tests/Http/HttpJsonResponseTest.php", "language": "php", "file_size": 3931, "cut_index": 614, "middle_length": 229 }
.com' => $this->factory::response('', HttpResponse::HTTP_MOVED_PERMANENTLY), 'forge.laravel.com' => $this->factory::response('', HttpResponse::HTTP_OK), ]); $response = $this->factory->post('http://vapor.laravel.com'); $this->assertTrue($response->movedPermanently()); $resp...
this->factory->post('http://vapor.laravel.com'); $this->assertTrue($response->noContent()); $response = $this->factory->post('http://forge.laravel.com'); $this->assertFalse($response->noContent()); } public function testFo
ry->fake([ 'vapor.laravel.com' => $this->factory::response('', HttpResponse::HTTP_NO_CONTENT), 'forge.laravel.com' => $this->factory::response('', HttpResponse::HTTP_OK), ]); $response = $
{ "filepath": "tests/Http/HttpClientTest.php", "language": "php", "file_size": 160579, "cut_index": 7068, "middle_length": 229 }
namespace Illuminate\Tests\Cache; use Illuminate\Cache\NullStore; use PHPUnit\Framework\TestCase; class CacheNullStoreTest extends TestCase { public function testItemsCanNotBeCached() { $store = new NullStore; $store->put('foo', 'bar', 10); $this->assertNull($store->get('foo')); }...
$this->assertFalse($store->decrement('foo')); } public function testTouchReturnsFalse(): void { $this->assertFalse((new NullStore)->touch('foo', 30)); } public function testLocksCanBeFlushed(): void { $store =
, $store->many([ 'foo', 'bar', ])); } public function testIncrementAndDecrementReturnFalse() { $store = new NullStore; $this->assertFalse($store->increment('foo'));
{ "filepath": "tests/Cache/CacheNullStoreTest.php", "language": "php", "file_size": 1234, "cut_index": 518, "middle_length": 229 }
rbon; use Illuminate\Tests\Cache\Fixtures\ArrayFilesystem; use PHPUnit\Framework\TestCase; class CacheStorageStoreTest extends TestCase { protected function tearDown(): void { Carbon::setTestNow(); parent::tearDown(); } public function testValuesCanBeStoredAndRetrieved() { ...
lesystem; $store = new StorageStore($disk, 'cache'); $store->put('foo', 'bar', 1); Carbon::setTestNow(Carbon::now()->addSeconds(2)); $this->assertNull($store->get('foo')); $this->assertFalse($disk->exists($store->
get('foo')); $this->assertStringStartsWith('cache/', $store->path('foo')); } public function testExpiredItemsReturnNullAndGetDeleted() { Carbon::setTestNow(Carbon::now()); $disk = new ArrayFi
{ "filepath": "tests/Cache/CacheStorageStoreTest.php", "language": "php", "file_size": 3357, "cut_index": 614, "middle_length": 229 }
e\Filesystem\Filesystem; use Illuminate\Foundation\Application; use InvalidArgumentException; use Mockery as m; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\NullOutput; class ClearCommandTest extends TestCase { /** * @var \Illuminate\Test...
doc} */ protected function setUp(): void { parent::setUp(); $this->cacheManager = m::mock(CacheManager::class); $this->files = m::mock(Filesystem::class); $this->cacheRepository = m::mock(Repository::class);
lluminate\Filesystem\Filesystem|\Mockery\MockInterface */ private $files; /** * @var \Illuminate\Contracts\Cache\Repository|\Mockery\MockInterface */ private $cacheRepository; /** * {@inherit
{ "filepath": "tests/Cache/ClearCommandTest.php", "language": "php", "file_size": 7386, "cut_index": 716, "middle_length": 229 }
', $v->validated()); $v = new Validator($trans, [ 'x' => null, ], [ 'x' => 'array', 'x.key' => 'string', ]); $this->assertFalse($v->passes()); } public function testNullableMakesNoDifferenceIfImplicitRuleExists() { $trans = $this-...
|integer', 'y' => 'nullable|required_with:x|integer', ]); $this->assertTrue($v->fails()); $this->assertSame('validation.integer', $v->messages()->get('x')[0]); $v = new Validator($trans, [ 'x' => 123
=> 'nullable|required_with:x|integer', ]); $this->assertTrue($v->passes()); $v = new Validator($trans, [ 'x' => 'value', 'y' => null, ], [ 'x' => 'nullable|required_with:y
{ "filepath": "tests/Validation/ValidationValidatorTest.php", "language": "php", "file_size": 456225, "cut_index": 13624, "middle_length": 229 }
is->getStore(); $table = m::mock(stdClass::class); $store->getConnection()->shouldReceive('table')->once()->with('table')->andReturn($table); $table->shouldReceive('whereIn')->once()->with('key', ['prefixfoo'])->andReturn($table); $table->shouldReceive('get')->once()->andReturn(collect([...
($getQuery); $getQuery->shouldReceive('get')->once()->andReturn(collect([(object) ['key' => 'prefixfoo', 'expiration' => 1]])); $deleteQuery = m::mock(stdClass::class); $deleteQuery->shouldReceive('whereIn')->once()->with('key', ['
class)->onlyMethods(['forgetIfExpired'])->setConstructorArgs($this->getMocks())->getMock(); $getQuery = m::mock(stdClass::class); $getQuery->shouldReceive('whereIn')->once()->with('key', ['prefixfoo'])->andReturn
{ "filepath": "tests/Cache/CacheDatabaseStoreTest.php", "language": "php", "file_size": 14610, "cut_index": 921, "middle_length": 229 }
c function testPutCreatesMissingDirectories() { $files = $this->mockFilesystem(); $hash = sha1('foo'); $contents = '0000000000'; $full_dir = __DIR__.'/'.substr($hash, 0, 2).'/'.substr($hash, 2, 2); $files->expects($this->once())->method('makeDirectory')->with($full_dir, 0777,...
ePath = __DIR__.'/'.substr($hash, 0, 2).'/'.substr($hash, 2, 2).'/'.$hash; $ten9s = '9999999999'; // The "forever" time value. $fileContents = $ten9s.serialize('gold'); $exclusiveLock = true; $files->expects($this->once())-
re->put('foo', $contents, 0); $this->assertTrue($result); } public function testPutWillConsiderZeroAsEternalTime() { $files = $this->mockFilesystem(); $hash = sha1('O--L / key'); $fil
{ "filepath": "tests/Cache/CacheFileStoreTest.php", "language": "php", "file_size": 19277, "cut_index": 1331, "middle_length": 229 }
namespace Illuminate\Tests\Http; use Illuminate\Http\Testing\MimeType; use PHPUnit\Framework\TestCase; use Symfony\Component\Mime\MimeTypesInterface; class HttpMimeTypeTest extends TestCase { public function testMimeTypeFromFileNameExistsTrue() { $this->assertSame('image/jpeg', MimeType::from('foo.jp...
meType::get('bar')); } public function testMimeTypeSymfonyInstance() { $this->assertInstanceOf(MimeTypesInterface::class, MimeType::getMimeTypes()); } public function testSearchExtensionFromMimeType() { $this->asse
meTypeFromExtensionExistsTrue() { $this->assertSame('image/jpeg', MimeType::get('jpg')); } public function testMimeTypeFromExtensionExistsFalse() { $this->assertSame('application/octet-stream', Mi
{ "filepath": "tests/Http/HttpMimeTypeTest.php", "language": "php", "file_size": 1131, "cut_index": 518, "middle_length": 229 }
Carbon; use Memcached; use Mockery as m; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use PHPUnit\Framework\TestCase; #[RequiresPhpExtension('memcached')] class CacheMemcachedStoreTest extends TestCase { public function testGetReturnsNullWhenNotFound() { $memcache = $this->getMockBuilder(Memc...
che = $this->getMockBuilder(Memcached::class)->onlyMethods(['get', 'getResultCode'])->getMock(); $memcache->expects($this->once())->method('get')->willReturn('bar'); $memcache->expects($this->once())->method('getResultCode')->willReturn(0);
once())->method('getResultCode')->willReturn(1); $store = new MemcachedStore($memcache, 'foo:'); $this->assertNull($store->get('bar')); } public function testMemcacheValueIsReturned() { $memca
{ "filepath": "tests/Cache/CacheMemcachedStoreTest.php", "language": "php", "file_size": 4902, "cut_index": 614, "middle_length": 229 }
re; use Illuminate\Cache\CacheManager; use Illuminate\Config\Repository as ConfigRepository; use Illuminate\Container\Container; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Facade; use Mockery as m; use Mockery\LegacyMockInterface; use PHPUnit\Framework\TestCase; class CacheSpyMemoTest extends...
$container->instance('cache', new CacheManager($container)); Facade::setFacadeApplication($container); } protected function tearDown(): void { Facade::clearResolvedInstances(); Facade::setFacadeApplication(nul
'cache' => [ 'default' => 'array', 'stores' => [ 'array' => [ 'driver' => 'array', ], ], ], ]));
{ "filepath": "tests/Cache/CacheSpyMemoTest.php", "language": "php", "file_size": 2395, "cut_index": 563, "middle_length": 229 }
te\Tests\Cache; use Illuminate\Cache\RateLimiting\GlobalLimit; use Illuminate\Cache\RateLimiting\Limit; use PHPUnit\Framework\TestCase; class LimitTest extends TestCase { public function testConstructors() { $limit = new Limit('', 3, 1); $this->assertSame(1, $limit->decaySeconds); $thi...
$this->assertSame(3, $limit->maxAttempts); $limit = Limit::perMinute(3, 4); $this->assertSame(240, $limit->decaySeconds); $this->assertSame(3, $limit->maxAttempts); $limit = Limit::perMinutes(2, 3); $this->ass
imit = Limit::perSecond(3, 5); $this->assertSame(5, $limit->decaySeconds); $this->assertSame(3, $limit->maxAttempts); $limit = Limit::perMinute(3); $this->assertSame(60, $limit->decaySeconds);
{ "filepath": "tests/Cache/LimitTest.php", "language": "php", "file_size": 1838, "cut_index": 537, "middle_length": 229 }
namespace Illuminate\Tests\Validation; use Illuminate\Translation\ArrayLoader; use Illuminate\Translation\Translator; use Illuminate\Validation\Validator; use PHPUnit\Framework\TestCase; class ValidatorAfterRuleTest extends TestCase { public function testAfterAcceptsArrayOfRules() { $validator = new ...
], $validator->messages()->messages()); } } class InvokableAfterRule { public function __invoke($validator) { $validator->errors()->add('invokableAfterRule', 'true'); } } class AfterMethodRule { public function __invo
erRule, new AfterMethodRule, ])->messages()->messages(); $this->assertSame([ 'closure' => ['true'], 'invokableAfterRule' => ['true'], 'afterMethodRule' => ['true'],
{ "filepath": "tests/Validation/ValidatorAfterRuleTest.php", "language": "php", "file_size": 1146, "cut_index": 518, "middle_length": 229 }
te\Tests\Cache; use Illuminate\Cache\ArrayStore; use Illuminate\Cache\CacheManager; use Illuminate\Cache\FailoverStore; use Illuminate\Cache\Repository; use Illuminate\Contracts\Cache\CanFlushLocks; use Illuminate\Contracts\Events\Dispatcher; use Mockery as m; use PHPUnit\Framework\TestCase; class CacheFailoverStoreT...
$storeA->lock('lock-a', 60)->get(); $storeB->lock('lock-b', 60)->get(); $cache = m::mock(CacheManager::class); $cache->shouldReceive('store')->with('store-a')->andReturn(new Repository($storeA)); $cache->shouldReceive('st
e([]); $this->assertInstanceOf(CanFlushLocks::class, $store); } public function testFlushLocksCallsFlushLocksOnAllBackingStores() { $storeA = new ArrayStore; $storeB = new ArrayStore;
{ "filepath": "tests/Cache/CacheFailoverStoreTest.php", "language": "php", "file_size": 1769, "cut_index": 537, "middle_length": 229 }
as m; use PHPUnit\Framework\TestCase; class CacheRateLimiterTest extends TestCase { public function testTooManyAttemptsReturnTrueIfAlreadyLockedOut() { $cache = m::mock(Cache::class); $cache->shouldReceive('get')->once()->with('key', 0)->andReturn(1); $cache->shouldReceive('has')->once(...
)->once()->with('key:timer', m::type('int'), 1)->andReturn(true); $cache->shouldReceive('add')->once()->with('key', 0, 1)->andReturn(true); $cache->shouldReceive('increment')->once()->with('key', 1)->andReturn(1); $cache->shouldRece
er($cache); $this->assertTrue($rateLimiter->tooManyAttempts('key', 1)); } public function testHitProperlyIncrementsAttemptCount() { $cache = m::mock(Cache::class); $cache->shouldReceive('add'
{ "filepath": "tests/Cache/CacheRateLimiterTest.php", "language": "php", "file_size": 9014, "cut_index": 716, "middle_length": 229 }
BufferedOutput; use Symfony\Component\VarDumper\Caster\ReflectionCaster; use Symfony\Component\VarDumper\Cloner\VarCloner; class CliDumperTest extends TestCase { protected function setUp(): void { CliDumper::resolveDumpSourceUsing(function () { return [ '/my-work-director/ap...
app/routes/console.php:18\n"; $this->assertSame($expected, $output); } public function testFloat() { $output = $this->dump(1.1); $expected = "1.1 // app/routes/console.php:18\n"; $this->assertSame($expected,
ing'); $expected = "\"string\" // app/routes/console.php:18\n"; $this->assertSame($expected, $output); } public function testInteger() { $output = $this->dump(1); $expected = "1 //
{ "filepath": "tests/Foundation/Console/CliDumperTest.php", "language": "php", "file_size": 6206, "cut_index": 716, "middle_length": 229 }
rk\Attributes\RequiresOperatingSystem; use PHPUnit\Framework\TestCase; use Symfony\Component\ErrorHandler\Exception\FlattenException; class FrameTest extends TestCase { #[RequiresOperatingSystem('Linux|Darwin')] #[DataProvider('unixFileDataProvider')] public function test_it_normalizes_file_path_on_unix($f...
'[internal function]', ]; yield 'unknown file' => [ ['file' => 123, 'line' => 10], '/path/to/your-app', '[unknown file]', ]; yield 'file with base path' => [ ['file' => '/pat
$this->assertEquals($expected, $frame->file()); } public static function unixFileDataProvider() { yield 'internal function' => [ ['line' => 10], '/path/to/your-app',
{ "filepath": "tests/Foundation/Exceptions/Renderer/FrameTest.php", "language": "php", "file_size": 5345, "cut_index": 716, "middle_length": 229 }
work\TestCase; class ListenerTest extends TestCase { public function test_queries_returns_expected_shape_after_query_executed() { $connection = m::mock(); $connection->shouldReceive('getName')->andReturn('testing'); $connection->shouldReceive('prepareBindings')->with(['foo'])->andRetur...
is->assertArrayHasKey('time', $query); $this->assertArrayHasKey('sql', $query); $this->assertArrayHasKey('bindings', $query); $this->assertSame('testing', $query['connectionName']); $this->assertSame(5.2, $query['time']);
; $queries = $listener->queries(); $this->assertIsArray($queries); $this->assertCount(1, $queries); $query = $queries[0]; $this->assertArrayHasKey('connectionName', $query); $th
{ "filepath": "tests/Foundation/Exceptions/Renderer/ListenerTest.php", "language": "php", "file_size": 6084, "cut_index": 716, "middle_length": 229 }
ected function setUp(): void { HtmlDumper::resolveDumpSourceUsing(function () { return [ '/my-work-director/app/routes/console.php', 'app/routes/console.php', 18, ]; }); $this->app = Container::getInstance(); } ...
e.php:18</span>\n</pre>"; $this->assertStringContainsString($expected, $output); } public function testFloat() { $output = $this->dump(1.1); $expected = "1.1</span><span style=\"color: #A0A0A0;\"> // app/routes/consol
$this->assertStringContainsString($expected, $output); } public function testInteger() { $output = $this->dump(1); $expected = "1</span><span style=\"color: #A0A0A0;\"> // app/routes/consol
{ "filepath": "tests/Foundation/Http/HtmlDumperTest.php", "language": "php", "file_size": 9477, "cut_index": 921, "middle_length": 229 }
rnel; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Routing\Router; use PHPUnit\Framework\TestCase; class KernelTest extends TestCase { public function testGetMiddlewareGroups() { $kernel = new Kernel($this->getApplication(), $this->getRouter()); $this->assertSame([...
e\Foundation\Http\Middleware\HandlePrecognitiveRequests::class, \Illuminate\Cookie\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSe
ame([], $kernel->getRouteMiddleware()); } public function testGetMiddlewarePriority() { $kernel = new Kernel($this->getApplication(), $this->getRouter()); $this->assertEquals([ \Illuminat
{ "filepath": "tests/Foundation/Http/KernelTest.php", "language": "php", "file_size": 6170, "cut_index": 716, "middle_length": 229 }
okie\Middleware\EncryptCookies; use Illuminate\Foundation\Configuration\Middleware; use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull; use Illuminate\Foundation\Http\Middleware\PreventRequestForgery; use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance; use Illuminate\Foundation\...
{ Container::setInstance(null); ConvertEmptyStringsToNull::flushState(); EncryptCookies::flushState(); PreventRequestForgery::flushState(); PreventRequestsDuringMaintenance::flushState(); TrimStrings::flushSt
Session; use Mockery as m; use PHPUnit\Framework\TestCase; use ReflectionClass; use Symfony\Component\HttpFoundation\Request as SymfonyRequest; class MiddlewareTest extends TestCase { protected function tearDown(): void
{ "filepath": "tests/Foundation/Configuration/MiddlewareTest.php", "language": "php", "file_size": 12694, "cut_index": 921, "middle_length": 229 }
g; use Illuminate\Foundation\Testing\DatabaseTransactionsManager; use PHPUnit\Framework\TestCase; class DatabaseTransactionsManagerTest extends TestCase { public function testItExecutesCallbacksImmediatelyIfThereIsOnlyOneTransaction() { $testObject = new TestingDatabaseTransactionsManagerTestObject; ...
$manager->begin('foo', 1); $manager->begin('foo', 2); $this->assertCount(1, $manager->callbackApplicableTransactions()); $this->assertEquals(2, $manager->callbackApplicableTransactions()[0]->level); } public function t
bject->ran); $this->assertEquals(1, $testObject->runs); } public function testItIgnoresTheBaseTransactionForCallbackApplicableTransactions() { $manager = new DatabaseTransactionsManager([null]);
{ "filepath": "tests/Foundation/Testing/DatabaseTransactionsManagerTest.php", "language": "php", "file_size": 2989, "cut_index": 563, "middle_length": 229 }
g; use Illuminate\Contracts\Console\Kernel as ConsoleKernelContract; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use Illuminate\Foundation\Testing\Concerns\InteractsWithConsole; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\RefreshDatabaseState; use Mockery as m; u...
etUp(): void { RefreshDatabaseState::$migrated = false; $this->setUpTheApplicationTestingHooks(); $this->withoutMockingConsoleOutput(); } protected function tearDown(): void { $this->tearDownTheApplicationT
path; class RefreshDatabaseTest extends TestCase { use ApplicationTestingHooks; use InteractsWithConsole; use RefreshDatabase; public $dropViews = false; public $dropTypes = false; protected function s
{ "filepath": "tests/Foundation/Testing/RefreshDatabaseTest.php", "language": "php", "file_size": 2738, "cut_index": 563, "middle_length": 229 }
g\Traits; use Illuminate\Foundation\Testing\Traits\CanConfigureMigrationCommands; use PHPUnit\Framework\TestCase; use ReflectionMethod; class CanConfigureMigrationCommandsTest extends TestCase { protected $traitObject; protected function setUp(): void { $this->traitObject = new CanConfigureMigrat...
Using'); $expected = [ '--drop-views' => false, '--drop-types' => false, '--seed' => false, ]; $this->assertEquals($expected, $migrateFreshUsingReflection->invoke($this->traitObject)); }
traitObject), $methodName ); } public function testMigrateFreshUsingDefault(): void { $migrateFreshUsingReflection = $this->__reflectAndSetupAccessibleForProtectedTraitMethod('migrateFresh
{ "filepath": "tests/Foundation/Testing/Traits/CanConfigureMigrationCommandsTest.php", "language": "php", "file_size": 2346, "cut_index": 563, "middle_length": 229 }
uminate\Foundation\Vite; use Illuminate\Support\Defer\DeferredCallbackCollection; use Orchestra\Testbench\TestCase; use stdClass; class InteractsWithContainerTest extends TestCase { public function testWithoutViteBindsEmptyHandlerAndReturnsInstance() { $instance = $this->withoutVite(); $this->...
this->withoutVite(); $this->assertSame('', app(Vite::class)->asset('path/to/asset.png')); $this->assertSame($this, $instance); } public function testWithViteRestoresOriginalHandlerAndReturnsInstance() { $handler = new
$instance = $this->withoutVite(); $this->assertSame('', app(Vite::class)->reactRefresh()); $this->assertSame($this, $instance); } public function testWithoutViteHandlesAsset() { $instance = $
{ "filepath": "tests/Foundation/Testing/Concerns/InteractsWithContainerTest.php", "language": "php", "file_size": 3252, "cut_index": 614, "middle_length": 229 }
recognitiveRequests; use Illuminate\Http\RedirectResponse; use Orchestra\Testbench\TestCase; class MakesHttpRequestsTest extends TestCase { public function testFromSetsHeaderAndSession() { $this->from('previous/url'); $this->assertSame('previous/url', $this->defaultHeaders['referer']); ...
his->assertSame('http://localhost/previous/url', $this->app['session']->previousUrl()); } public function testFromRemoveHeader() { $this->withHeader('name', 'Milwad')->from('previous/url'); $this->assertSame('Milwad', $this->d
ss); $router->get('previous/url', fn () => 'ok')->name('previous-url'); $this->fromRoute('previous-url'); $this->assertSame('http://localhost/previous/url', $this->defaultHeaders['referer']); $t
{ "filepath": "tests/Foundation/Testing/Concerns/MakesHttpRequestsTest.php", "language": "php", "file_size": 8253, "cut_index": 716, "middle_length": 229 }
ework\TestCase; class AuthenticatableTest extends TestCase { public function testItReturnsSameRememberTokenForString() { $user = new User; $user->setRememberToken('sample_token'); $this->assertSame('sample_token', $user->getRememberToken()); } public function testItReturnsStrin...
y() { $user = new class extends User { public function getRememberTokenName() { return ''; } }; $user->setRememberToken(true); $this->assertNull($user->getRemem
n testItReturnsNullWhenRememberTokenNameWasSetToEmpt
{ "filepath": "tests/Auth/AuthenticatableTest.php", "language": "php", "file_size": 935, "cut_index": 606, "middle_length": 52 }
xception; use Mockery as m; use PHPUnit\Framework\TestCase; class FoundationFormRequestTest extends TestCase { protected $mocks = []; protected function tearDown(): void { FormRequest::failOnUnknownFields(false); Container::setInstance(null); $this->mocks = []; parent::t...
> 'bar', 'baz' => ''], 'array' => [1, 2]]; $request = $this->createRequest($payload, FoundationTestFormRequestNestedStub::class); $request->validateResolved(); $this->assertEquals(['nested' => ['foo' => 'bar'], 'array' => [1, 2]]
->validateResolved(); $this->assertEquals(['name' => 'specified'], $request->validated()); } public function testValidatedMethodReturnsTheValidatedDataNestedRules() { $payload = ['nested' => ['foo' =
{ "filepath": "tests/Foundation/FoundationFormRequestTest.php", "language": "php", "file_size": 28617, "cut_index": 1331, "middle_length": 229 }
ion setUp(): void { $this->connection = m::mock(Connection::class); } public function testSeeInDatabaseFindsResults() { $this->mockCountBuilder(true); $this->assertDatabaseHas($this->table, $this->data); } public function testAssertDatabaseHasSupportsModelClass() {...
public function testAssertDatabaseSupportsArrays() { $builder = m::mock(Builder::class); $builder->shouldReceive('where')->with(['title' => 'Spark', 'name' => 'Laravel'])->once()->andReturnSelf(); $builder->shouldReceive('where'
ata = $this->data; $this->data = [ 'id' => 1, ...$this->data, ]; $this->mockCountBuilder(true); $this->assertDatabaseHas(new ProductStub(['id' => 1]), $data); }
{ "filepath": "tests/Foundation/FoundationInteractsWithDatabaseTest.php", "language": "php", "file_size": 20175, "cut_index": 1331, "middle_length": 229 }
nts(); $this->assertStringContainsString( '<link rel="preload" as="font" href="https://example.com/build/assets/inter-400.woff2" type="font/woff2" crossorigin="anonymous" />', $result->toHtml() ); $this->assertStringContainsString( "<style>\n@font-face { font...
strpos($result, '<link rel="preload"'); $stylePos = strpos($result, '<style>'); $this->assertNotFalse($preloadPos); $this->assertNotFalse($stylePos); $this->assertLessThan($stylePos, $preloadPos); } public functio
{ $this->makeFontsManifest(); $this->makeFontsCssFile('build', 'assets/fonts-abc123.css', "@font-face { font-family: 'Inter'; }"); $result = app(Vite::class)->fonts()->toHtml(); $preloadPos =
{ "filepath": "tests/Foundation/FoundationViteFontsTest.php", "language": "php", "file_size": 46933, "cut_index": 2151, "middle_length": 229 }
dation\LaravelCloudJsonFormatter; use Illuminate\Http\Request; use Monolog\Level; use Monolog\LogRecord; use PHPUnit\Framework\TestCase; class LaravelCloudJsonFormatterTest extends TestCase { protected function setUp(): void { parent::setUp(); Container::setInstance(new Container); } p...
unction test_adds_cloud_request_id_as_top_level_key() { $app = Container::getInstance(); $request = Request::create('/'); $request->headers->set('Cloud-Request-ID', '550e8400-e29b-41d4-a716-446655440000'); $app->instance
ecord( message: 'Test message', level: Level::Info, channel: 'test', datetime: new \DateTimeImmutable, extra: [], context: [], ); } public f
{ "filepath": "tests/Foundation/LaravelCloudJsonFormatterTest.php", "language": "php", "file_size": 3387, "cut_index": 614, "middle_length": 229 }
rap; use Closure; use Illuminate\Filesystem\Filesystem; use Illuminate\Foundation\Application; use Illuminate\Foundation\Bootstrap\LoadConfiguration; use PHPUnit\Framework\TestCase; use ReflectionClass; class LoadConfigurationTest extends TestCase { public function testLoadsBaseConfiguration() { $app ...
anceOf( Closure::class, (new ReflectionClass($app))->getProperty('environmentResolver')->getValue($app) ); } public function testDontLoadBaseConfiguration() { $app = new Application(); $app->dont
r() { $app = new Application(); $this->assertNull((new ReflectionClass($app))->getProperty('environmentResolver')->getValue($app)); (new LoadConfiguration)->bootstrap($app); $this->assertInst
{ "filepath": "tests/Foundation/Bootstrap/LoadConfigurationTest.php", "language": "php", "file_size": 2188, "cut_index": 563, "middle_length": 229 }
Worker::$restartable = true; Worker::$pausable = true; $_SERVER['LARAVEL_CLOUD'] = '1'; $_SERVER['LARAVEL_CLOUD_MANAGED_QUEUES_CONFIG'] = json_encode([ 'driver' => 'cloud', 'connection' => [ 'driver' => 'sqs', 'region' => 'us-east-2', ...
parent::tearDown(); unset($_SERVER['LARAVEL_CLOUD'], $_SERVER['LARAVEL_CLOUD_MANAGED_QUEUES_CONFIG']); Worker::$restartable = true; Worker::$pausable = true; } public function testItDisablesQueueRestartPollingForManag
], ]); parent::setUp(); $this->app['config']->set('queue.connections.cloud', json_decode($_SERVER['LARAVEL_CLOUD_MANAGED_QUEUES_CONFIG'], true)); } protected function tearDown(): void {
{ "filepath": "tests/Foundation/Cloud/QueueTest.php", "language": "php", "file_size": 36051, "cut_index": 2151, "middle_length": 229 }
pace Illuminate\Tests\Foundation\Console; use Illuminate\Foundation\Console\AboutCommand; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class AboutCommandTest extends TestCase { /** * @param \Closure(bool):mixed $format * @param mixed $expected */ #[DataProv...
'NO'), 'NO']; } /** * @param \Closure(bool):mixed $format * @param mixed $expected */ #[DataProvider('jsonDataProvider')] public function testItCanFormatForJsonInterface($format, $expected) { $this->assertSam
tion cliDataProvider() { yield [AboutCommand::format(true, console: fn ($value) => $value === true ? 'YES' : 'NO'), 'YES']; yield [AboutCommand::format(false, console: fn ($value) => $value === true ? 'YES' :
{ "filepath": "tests/Foundation/Console/AboutCommandTest.php", "language": "php", "file_size": 1320, "cut_index": 524, "middle_length": 229 }
setUp(): void { parent::setUp(); $this->app = new Application( $laravel = new \Illuminate\Foundation\Application(__DIR__), m::mock(Dispatcher::class, ['dispatch' => null, 'fire' => null]), 'testing', ); $router = new Router(m::mock('Illuminate\E...
eware 2', 'Middleware 3', ]; }; $kernel->prependToMiddlewarePriority('Middleware 5'); $laravel->instance(Kernel::class, $kernel); $router->get('/example', function () { return 'Hell
2', 'Middleware 5'], 'auth' => ['Middleware 3', 'Middleware 4'], ]; protected $middlewarePriority = [ 'Middleware 1', 'Middleware 4', 'Middl
{ "filepath": "tests/Foundation/Console/RouteListCommandTest.php", "language": "php", "file_size": 10359, "cut_index": 921, "middle_length": 229 }
g; use Illuminate\Foundation\Testing\Attributes\SetUp; use Illuminate\Foundation\Testing\Attributes\TearDown; use Illuminate\Foundation\Testing\TestCase as FoundationTestCase; use Orchestra\Testbench\Concerns\CreatesApplication; use PHPUnit\Framework\TestCase; use ReflectionMethod; trait TestTrait { public $setUp...
#[TearDown] public function cleanUpSearch() { $this->attributeTearDown = true; } } class TestCaseWithTrait extends FoundationTestCase { use CreatesApplication; use TestTrait; } class TestCaseWithAttributeTrait extends Foundat
true; } } trait TestTraitWithAttributes { public $attributeSetUp = false; public $attributeTearDown = false; #[SetUp] public function initializeSearch() { $this->attributeSetUp = true; }
{ "filepath": "tests/Foundation/Testing/BootTraitsTest.php", "language": "php", "file_size": 2802, "cut_index": 563, "middle_length": 229 }
oleKernelContract; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use Illuminate\Foundation\Testing\Concerns\InteractsWithConsole; use Illuminate\Foundation\Testing\DatabaseMigrations; use Illuminate\Foundation\Testing\RefreshDatabaseState; use Mockery as m; use Orchestra\Testbench\Concerns\ApplicationTesti...
State::$migrated = false; $this->afterApplicationCreated(function () { $this->app['config']->set([ 'database.default' => 'testing', 'database.connections.testing' => [ 'driver' => 'sq
Case { use ApplicationTestingHooks; use DatabaseMigrations; use InteractsWithConsole; public $dropViews = false; public $dropTypes = false; protected function setUp(): void { RefreshDatabase
{ "filepath": "tests/Foundation/Testing/DatabaseMigrationsTest.php", "language": "php", "file_size": 3083, "cut_index": 614, "middle_length": 229 }
g; use Carbon\CarbonImmutable; use Illuminate\Foundation\Testing\Wormhole; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Date; use PHPUnit\Framework\TestCase; class WormholeTest extends TestCase { protected function tearDown(): void { Date::useDefault(); parent::tearDown(); ...
sert we can go back to the present... $this->assertEquals($present->format('Y-m-d'), Wormhole::back()->format('Y-m-d')); } public function testCarbonImmutableCompatibility() { // Tell the Date Factory to use CarbonImmutable...
()->addDays(10); // Travel in time... (new Wormhole(10))->days(); // Assert we are now in the future... $this->assertEquals($future->format('Y-m-d'), Date::now()->format('Y-m-d')); // As
{ "filepath": "tests/Foundation/Testing/WormholeTest.php", "language": "php", "file_size": 2029, "cut_index": 563, "middle_length": 229 }
Mockery as m; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use PHPUnit\Framework\TestCase; use stdClass; class CacheMemcachedConnectorTest extends TestCase { public function testServersAreAddedCorrectly() { $memcached = $this->memcachedMockWithAddServer(); $connector = $this->connect...
edMockWithAddServer(); $connector = $this->connectorMock(); $connector->expects($this->once()) ->method('createMemcachedInstance') ->with($persistentConnectionId) ->willReturn($memcached); $resu
$this->assertSame($result, $memcached); } public function testServersAreAddedCorrectlyWithPersistentConnection() { $persistentConnectionId = 'persistent_connection_id'; $memcached = $this->memcach
{ "filepath": "tests/Cache/CacheMemcachedConnectorTest.php", "language": "php", "file_size": 3908, "cut_index": 614, "middle_length": 229 }
sion\Store; use Illuminate\Support\MessageBag; use Illuminate\Support\ViewErrorBag; use Mockery as m; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Cookie; class HttpRedirectResponseTest extends TestCase { public function testHeaderOnRedirect() { $response = new RedirectResponse(...
tion testWithOnRedirect() { $response = new RedirectResponse('foo.bar'); $response->setRequest(Request::create('/', 'GET', ['name' => 'Taylor', 'age' => 26])); $response->setSession($session = m::mock(Store::class)); $se
nse->header('foo', 'baz', false); $this->assertSame('bar', $response->headers->get('foo')); $response->header('foo', 'baz'); $this->assertSame('baz', $response->headers->get('foo')); } public func
{ "filepath": "tests/Http/HttpRedirectResponseTest.php", "language": "php", "file_size": 9012, "cut_index": 716, "middle_length": 229 }
ication as ApplicationContract; use Illuminate\Filesystem\Filesystem; use Illuminate\Foundation\Application; use Illuminate\Foundation\ProviderRepository; use Illuminate\Support\ServiceProvider; use Mockery as m; use PHPUnit\Framework\TestCase; use stdClass; class FoundationProviderRepositoryTest extends TestCase { ...
iders'], 'when' => []]); $repo->shouldReceive('shouldRecompile')->once()->andReturn(false); $app->shouldReceive('register')->once()->with('foo'); $app->shouldReceive('runningInConsole')->andReturn(false); $app->shouldReceiv
oadManifest,shouldRecompile]', [$app, m::mock(Filesystem::class), [__DIR__.'/services.php']]); $repo->shouldReceive('loadManifest')->once()->andReturn(['eager' => ['foo'], 'deferred' => ['deferred'], 'providers' => ['prov
{ "filepath": "tests/Foundation/FoundationProviderRepositoryTest.php", "language": "php", "file_size": 4632, "cut_index": 614, "middle_length": 229 }
dleExceptionsTest extends TestCase { protected $app; protected $config; protected function setUp(): void { $this->app = m::mock(Application::setInstance(new Application)); $this->app->instance('config', $this->config = new Config()); } protected function handleExceptions() ...
::mock(LogManager::class); $this->app->instance(LogManager::class, $logger); $this->app->expects('runningUnitTests')->andReturn(false); $this->app->expects('hasBeenBootstrapped')->andReturn(true); $logger->expects('channel'
rotected function tearDown(): void { Application::setInstance(null); HandleExceptions::flushState($this); parent::tearDown(); } public function testPhpDeprecations() { $logger = m
{ "filepath": "tests/Foundation/Bootstrap/HandleExceptionsTest.php", "language": "php", "file_size": 14605, "cut_index": 921, "middle_length": 229 }
pace Illuminate\Tests\Foundation\Bootstrap; use Illuminate\Foundation\Application; use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables; use Mockery as m; use PHPUnit\Framework\TestCase; class LoadEnvironmentVariablesTest extends TestCase { protected function tearDown(): void { unset($_ENV['FO...
->once()->with()->andReturn(__DIR__.'/../fixtures'); $app->shouldReceive('environmentFile') ->once()->with()->andReturn($file); return $app; } public function testCanLoad() { $this->expectOutputStr
ldReceive('configurationIsCached') ->once()->with()->andReturn(false); $app->shouldReceive('runningInConsole') ->once()->with()->andReturn(false); $app->shouldReceive('environmentPath')
{ "filepath": "tests/Foundation/Bootstrap/LoadEnvironmentVariablesTest.php", "language": "php", "file_size": 1475, "cut_index": 524, "middle_length": 229 }
uration; use Exception; use Illuminate\Container\Container; use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Foundation\Configuration\Exceptions; use Illuminate\Foundation\Exceptions\Handler; use Illuminate\Http\Request; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpKernel\Exception\...
>assertContains(HttpException::class, $handler->getDontReport()); $exceptions = $exceptions->stopIgnoring(HttpException::class); $this->assertInstanceOf(Exceptions::class, $exceptions); $this->assertNotContains(HttpException::class,
ss($container) extends Handler { public function getDontReport(): array { return array_merge($this->dontReport, $this->internalDontReport); } }); $this-
{ "filepath": "tests/Foundation/Configuration/ExceptionsTest.php", "language": "php", "file_size": 2087, "cut_index": 563, "middle_length": 229 }
use DatabaseTruncation; private ?array $app; private ?array $tablesToTruncate = null; private ?array $exceptTables = null; protected function setUp(): void { parent::setUp(); $this->app['config'] = new Repository([ 'database' => [ 'migrations' =>...
edTables, [ ['schema' => null, 'name' => 'foo', 'schema_qualified_name' => 'foo'], ['schema' => null, 'name' => 'bar', 'schema_qualified_name' => 'bar'], ]); $this->truncateTablesForConnection($connection, 'test');
llTables = []; $this->tablesToTruncate = null; $this->exceptTables = null; parent::tearDown(); } public function testTruncateTables() { $connection = $this->arrangeConnection($truncat
{ "filepath": "tests/Foundation/Testing/DatabaseTruncationTest.php", "language": "php", "file_size": 9564, "cut_index": 921, "middle_length": 229 }
te\Tests\Foundation\Testing\Concerns; use Illuminate\Foundation\Testing\Concerns\InteractsWithViews; use Illuminate\Testing\TestComponent; use Illuminate\View\Component; use Orchestra\Testbench\TestCase; class InteractsWithViewsTest extends TestCase { use InteractsWithViews; public function testBladeCorrectl...
ic function render() { return 'rendered content'; } }; $component = $this->component(get_class($exampleComponent)); $this->assertSame('bar', $component->foo); $this->assertSame('hell
perties() { $exampleComponent = new class extends Component { public $foo = 'bar'; public function speak() { return 'hello'; } publ
{ "filepath": "tests/Foundation/Testing/Concerns/InteractsWithViewsTest.php", "language": "php", "file_size": 1527, "cut_index": 537, "middle_length": 229 }
Illuminate\Foundation\Testing\Concerns\InteractsWithTime; use Illuminate\Support\Carbon; use PHPUnit\Framework\TestCase; class FoundationInteractsWithTimeTest extends TestCase { use InteractsWithTime; protected function tearDown(): void { Carbon::setTestNow(); parent::tearDown(); } ...
345; }); $this->assertSame(12345, $actual); $this->assertFalse(Carbon::hasTestNow()); } public function testFreezeTimeReturnsCallbackResultEvenWhenNull() { $actual = $this->freezeTime(function () {
erface::class, $actual); $this->assertTrue(Carbon::getTestNow()->eq($actual)); } public function testFreezeTimeReturnsCallbackResult() { $actual = $this->freezeTime(function () { return 12
{ "filepath": "tests/Foundation/FoundationInteractsWithTimeTest.php", "language": "php", "file_size": 2030, "cut_index": 563, "middle_length": 229 }
urces/js/app.js'], $buildDir); $this->assertStringEndsWith( '<link rel="stylesheet" href="https://example.com/'.$buildDir.'/assets/layout.versioned.css" />' .'<link rel="stylesheet" href="https://example.com/'.$buildDir.'/assets/header.versioned.css" />' .'<script type="modu...
000/@vite/client"></script>' .'<script type="module" src="http://localhost:3000/resources/js/app.js"></script>', $result->toHtml() ); } public function testViteHotModuleReplacementWithJsAndCss() { $this-
n testViteHotModuleReplacementWithJsOnly() { $this->makeViteHotFile(); $result = app(Vite::class)('resources/js/app.js'); $this->assertSame( '<script type="module" src="http://localhost:3
{ "filepath": "tests/Foundation/FoundationViteTest.php", "language": "php", "file_size": 89483, "cut_index": 3790, "middle_length": 229 }
ork\TestCase; class PaginatorTest extends TestCase { public function testSimplePaginatorReturnsRelevantContextInformation() { /** @var Paginator<int, string> $p */ $p = new Paginator(['item3', 'item4', 'item5'], 2, 2); $this->assertEquals(2, $p->currentPage()); $this->assertTru...
'to' => 4, 'data' => ['item3', 'item4'], 'path' => '/', ]; $this->assertEquals($pageInfo, $p->toArray()); } public function testPaginatorRemovesTrailingSlashes() { $p = new Paginator(['item
'current_page' => 2, 'first_page_url' => '/?page=1', 'current_page_url' => '/?page=2', 'next_page_url' => '/?page=3', 'prev_page_url' => '/?page=1', 'from' => 3,
{ "filepath": "tests/Pagination/PaginatorTest.php", "language": "php", "file_size": 3473, "cut_index": 614, "middle_length": 229 }
Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Pagination\UrlWindow; use PHPUnit\Framework\TestCase; class UrlWindowTest extends TestCase { public function testPresenterCanDetermineIfThereAreAnyPagesToShow() { $p = new LengthAwarePaginator($array = ['item1', 'item2', 'item3', 'item4'], 4, 2...
indow->get()); } public function testPresenterCanGetAUrlRangeForAWindowOfLinks() { $array = []; for ($i = 1; $i <= 20; $i++) { $array[$i] = 'item'.$i; } $p = new LengthAwarePaginator($array, count($a
LengthAwarePaginator($array = ['item1', 'item2', 'item3', 'item4'], 4, 2, 2); $window = new UrlWindow($p); $this->assertEquals(['first' => [1 => '/?page=1', 2 => '/?page=2'], 'slider' => null, 'last' => null], $w
{ "filepath": "tests/Pagination/UrlWindowTest.php", "language": "php", "file_size": 2469, "cut_index": 563, "middle_length": 229 }
Illuminate\JsonSchema\JsonSchema; use PHPUnit\Framework\TestCase; class ArrayTypeTest extends TestCase { public function test_it_may_set_min_items(): void { $type = JsonSchema::array()->title('Tags')->min(1); $this->assertEquals([ 'type' => 'array', 'title' => 'Tags', ...
ype(): void { $type = JsonSchema::array()->items( JsonSchema::string()->max(20) ); $this->assertEquals([ 'type' => 'array', 'items' => [ 'type' => 'string', 'm
>max(10); $this->assertEquals([ 'type' => 'array', 'description' => 'A list of tags', 'maxItems' => 10, ], $type->toArray()); } public function test_it_may_set_items_t
{ "filepath": "tests/JsonSchema/ArrayTypeTest.php", "language": "php", "file_size": 2633, "cut_index": 563, "middle_length": 229 }
pace Illuminate\Tests\JsonSchema; use Illuminate\JsonSchema\JsonSchema; use PHPUnit\Framework\TestCase; class BooleanTypeTest extends TestCase { public function test_serializes_as_boolean_with_metadata(): void { $type = JsonSchema::boolean()->title('Enabled')->description('Feature flag'); $th...
} public function test_may_set_default_false_via_default(): void { $type = JsonSchema::boolean()->default(false); $this->assertEquals([ 'type' => 'boolean', 'default' => false, ], $type->toArray()
_may_set_default_true_via_default(): void { $type = JsonSchema::boolean()->default(true); $this->assertEquals([ 'type' => 'boolean', 'default' => true, ], $type->toArray());
{ "filepath": "tests/JsonSchema/BooleanTypeTest.php", "language": "php", "file_size": 1270, "cut_index": 524, "middle_length": 229 }
te\Tests\JsonSchema; use Illuminate\JsonSchema\JsonSchema; use PHPUnit\Framework\TestCase; class IntegerTypeTest extends TestCase { public function test_it_may_set_min_value(): void { $type = JsonSchema::integer()->title('Age')->min(5); $this->assertEquals([ 'type' => 'integer', ...
it_may_set_default_value(): void { $type = JsonSchema::integer()->default(18); $this->assertEquals([ 'type' => 'integer', 'default' => 18, ], $type->toArray()); } public function test_it_may_set
>description('Max age')->max(10); $this->assertEquals([ 'type' => 'integer', 'description' => 'Max age', 'maximum' => 10, ], $type->toArray()); } public function test_
{ "filepath": "tests/JsonSchema/IntegerTypeTest.php", "language": "php", "file_size": 1828, "cut_index": 537, "middle_length": 229 }
Illuminate\JsonSchema\JsonSchema; use PHPUnit\Framework\TestCase; class NumberTypeTest extends TestCase { public function test_it_may_set_min_value_as_float(): void { $type = JsonSchema::number()->title('Price')->min(5.5); $this->assertEquals([ 'type' => 'number', 'titl...
loat(): void { $type = JsonSchema::number()->description('Max price')->max(10.75); $this->assertEquals([ 'type' => 'number', 'description' => 'Max price', 'maximum' => 10.75, ], $type->toArra
('Price')->min(5); $this->assertEquals([ 'type' => 'number', 'title' => 'Price', 'minimum' => 5, ], $type->toArray()); } public function test_it_may_set_max_value_as_f
{ "filepath": "tests/JsonSchema/NumberTypeTest.php", "language": "php", "file_size": 2735, "cut_index": 563, "middle_length": 229 }
onSchema\JsonSchemaTypeFactory; use PHPUnit\Framework\TestCase; class ObjectTypeTest extends TestCase { public function test_it_may_not_have_properties(): void { $type = JsonSchema::object()->title('Payload'); $this->assertEquals([ 'type' => 'object', 'title' => 'Payloa...
onSchema::object([ 'age-a' => JsonSchema::integer()->min(0)->required(), 'age-b' => JsonSchema::integer()->default(30)->max(45), ])->description('Root object'); $this->assertEquals([ 'type' => 'object',
le('Payload'); $this->assertEquals([ 'type' => 'object', 'title' => 'Payload', ], $type->toArray()); } public function test_it_may_have_properties(): void { $type = Js
{ "filepath": "tests/JsonSchema/ObjectTypeTest.php", "language": "php", "file_size": 3583, "cut_index": 614, "middle_length": 229 }
te\Tests\JsonSchema; use Illuminate\JsonSchema\Types\StringType; use PHPUnit\Framework\TestCase; class StringTypeTest extends TestCase { public function test_it_sets_min_length() { $type = (new StringType)->min(5); $this->assertEquals([ 'type' => 'string', 'minLength' ...
)->default('foo')->pattern('^foo.*$'); $this->assertEquals([ 'type' => 'string', 'default' => 'foo', 'pattern' => '^foo.*$', ], $type->toArray()); } public function test_it_sets_format() {
ls([ 'type' => 'string', 'description' => 'User handle', 'maxLength' => 10, ], $type->toArray()); } public function test_it_sets_pattern() { $type = (new StringType
{ "filepath": "tests/JsonSchema/StringTypeTest.php", "language": "php", "file_size": 1508, "cut_index": 537, "middle_length": 229 }
$this->assertEquals([ 'type' => 'object', 'title' => 'User', 'description' => 'User payload', 'default' => ['age' => 20], 'properties' => [ 'age' => [ 'type' => 'integer', 'minimum' => 0, ...
ge": { "minimum": 0, "type": "integer" } }, "type": "object", "required": [ "age" ] } JSON, $type->toString()); }
chema::object([ 'age' => JsonSchema::integer()->min(0)->required(), ])->title('User'); $this->assertSame(<<<'JSON' { "title": "User", "properties": { "a
{ "filepath": "tests/JsonSchema/TypeTest.php", "language": "php", "file_size": 19511, "cut_index": 1331, "middle_length": 229 }
me |-------------------------------------------------------------------------- | | This value is the name of your application, which will be used when the | framework needs to place the application's name in a notification or | other UI elements where an application name needs to be displayed. |...
e application utilizes. Set this in your ".env" file. | */ 'env' => env('APP_ENV', 'production'), /* |-------------------------------------------------------------------------- | Application Debug Mode |-----------------------
-------------------------------------------------------- | | This value determines the "environment" your application is currently | running in. This may determine how you prefer to configure various | services th
{ "filepath": "config/app.php", "language": "php", "file_size": 6634, "cut_index": 716, "middle_length": 229 }
- | Authentication Defaults |-------------------------------------------------------------------------- | | This option defines the default authentication "guard" and password | reset "broker" for your application. You may change these values | as required, but they're a perfect start for most a...
our application. | Of course, a great default configuration has been defined for you | which utilizes session storage plus the Eloquent user provider. | | All authentication guards have a user provider, which defines how the | users are
------------------------------------------------------- | Authentication Guards |-------------------------------------------------------------------------- | | Next, you may define every authentication guard for y
{ "filepath": "config/auth.php", "language": "php", "file_size": 4029, "cut_index": 614, "middle_length": 229 }
---------------------------------------------------- | Default Broadcaster |-------------------------------------------------------------------------- | | This option controls the default broadcaster that will be used by the | framework when an event needs to be broadcast. You may set this to | ...
ou may define all of the broadcast connections that will be used | to broadcast events to other systems or over WebSockets. Samples of | each available type of connection are provided inside this array. | */ 'connections' => [
ION', 'null'), /* |-------------------------------------------------------------------------- | Broadcast Connections |-------------------------------------------------------------------------- | | Here y
{ "filepath": "config/broadcasting.php", "language": "php", "file_size": 2682, "cut_index": 563, "middle_length": 229 }
------------------------------ | Default Cache Store |-------------------------------------------------------------------------- | | This option controls the default cache store that will be used by the | framework. This connection is utilized if another isn't explicitly | specified when running...
ne multiple stores for the | same cache driver to group types of items stored in your caches. | | Supported drivers: "array", "database", "file", "memcached", | "redis", "dynamodb", "storage", "octane", |
- | Cache Stores |-------------------------------------------------------------------------- | | Here you may define all of the cache "stores" for your application as | well as their drivers. You may even defi
{ "filepath": "config/cache.php", "language": "php", "file_size": 4024, "cut_index": 614, "middle_length": 229 }
|-------------------------------------------------------------------------- | Cross-Origin Resource Sharing (CORS) Configuration |-------------------------------------------------------------------------- | | Here you may configure your settings for cross-origin resource sharing | or "CORS". Th...
*', 'sanctum/csrf-cookie'], 'allowed_methods' => ['*'], 'allowed_origins' => ['*'], 'allowed_origins_patterns' => [], 'allowed_headers' => ['*'], 'exposed_headers' => [], 'max_age' => 0, 'supports_credentials' => false,
cs/Web/HTTP/CORS | */ 'paths' => ['api/
{ "filepath": "config/cors.php", "language": "php", "file_size": 846, "cut_index": 535, "middle_length": 52 }
-------------------------------------------------------------- | | Here you may specify which of the database connections below you wish | to use as your default connection for database operations. This is | the connection which will be utilized unless another connection | is explicitly specified wh...
for each database system which | is supported by Laravel. You're free to add / remove connections. | */ 'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'url' => env('DB_URL'), 'database'
Database Connections |-------------------------------------------------------------------------- | | Below are all of the database connections defined for your application. | An example configuration is provided
{ "filepath": "config/database.php", "language": "php", "file_size": 6924, "cut_index": 716, "middle_length": 229 }
---------------------------------------------------- | Default Filesystem Disk |-------------------------------------------------------------------------- | | Here you may specify the default filesystem disk that should be used | by the framework. The "local" disk, as well as a variety of cloud ...
nfigure multiple disks for the same driver. Examples for | most supported storage drivers are configured here for reference. | | Supported drivers: "local", "ftp", "sftp", "s3" | */ 'disks' => [ 'local' => [ 'd
------------------------- | Filesystem Disks |-------------------------------------------------------------------------- | | Below you may configure as many filesystem disks as necessary, and you | may even co
{ "filepath": "config/filesystems.php", "language": "php", "file_size": 2521, "cut_index": 563, "middle_length": 229 }
---------------------------------------------------- | Default Hash Driver |-------------------------------------------------------------------------- | | This option controls the default hash driver that will be used to hash | passwords for your application. By default, the bcrypt algorithm is ...
options that should be used when | passwords are hashed using the Bcrypt algorithm. This will allow you | to control the amount of time it takes to hash the given password. | */ 'bcrypt' => [ 'rounds' => env('BCRYPT_ROUNDS', 12
|-------------------------------------------------------------------------- | Bcrypt Options |-------------------------------------------------------------------------- | | Here you may specify the configuration
{ "filepath": "config/hashing.php", "language": "php", "file_size": 2253, "cut_index": 563, "middle_length": 229 }
dpHandler; use Monolog\Processor\PsrLogMessageProcessor; return [ /* |-------------------------------------------------------------------------- | Default Log Channel |-------------------------------------------------------------------------- | | This option defines the default log channel tha...
---- | | This option controls the log channel that should be used to log warnings | regarding deprecated PHP and library features. This allows you to get | your application ready for upcoming major versions of dependencies. | */
t' => env('LOG_CHANNEL', 'stack'), /* |-------------------------------------------------------------------------- | Deprecations Log Channel |----------------------------------------------------------------------
{ "filepath": "config/logging.php", "language": "php", "file_size": 4327, "cut_index": 614, "middle_length": 229 }
- | Default Mailer |-------------------------------------------------------------------------- | | This option controls the default mailer that is used to send all email | messages unless another mailer is explicitly specified when sending | the message. All additional mailers can be configured ...
| their respective settings. Several examples have been configured for | you and you are free to add your own as your application requires. | | Laravel supports a variety of mail "transport" drivers that can be used | when delivering an em
--------------------------------- | Mailer Configurations |-------------------------------------------------------------------------- | | Here you may configure all of the mailers used by your application plus
{ "filepath": "config/mail.php", "language": "php", "file_size": 4350, "cut_index": 614, "middle_length": 229 }
- | Default Queue Connection Name |-------------------------------------------------------------------------- | | Laravel's queue supports a variety of backends via a single, unified | API, giving you convenient access to each backend using identical | syntax for each. The default queue connecti...
s provided for | each backend supported by Laravel. You're also free to add more. | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", | "deferred", "failover", "null" | */ 'connections' => [ 'sync'
nections |-------------------------------------------------------------------------- | | Here you may configure the connection options for every queue backend | used by your application. An example configuration i
{ "filepath": "config/queue.php", "language": "php", "file_size": 4436, "cut_index": 614, "middle_length": 229 }
?php return [ /* |-------------------------------------------------------------------------- | Third Party Services |-------------------------------------------------------------------------- | | This file is for storing the credentials for third party services such | as Mailgun, Postmark,...
ECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], 'slack' => [ 'notifications' => [ 'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'), 'channel' => env('SLACK_BOT_USER_DEFA
*/ 'postmark' => [ 'token' => env('POSTMARK_TOKEN'), ], 'resend' => [ 'key' => env('RESEND_KEY'), ], 'ses' => [ 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_S
{ "filepath": "config/services.php", "language": "php", "file_size": 1035, "cut_index": 513, "middle_length": 229 }
------------------------------------- | | This option determines the default session driver that is utilized for | incoming requests. Laravel supports a variety of storage options to | persist session data. Database storage is a great default choice. | | Supported: "file", "cookie", "database", ...
main idle before it expires. If you want them | to expire immediately when the browser is closed then you may | indicate that via the expire_on_close configuration option. | */ 'lifetime' => (int) env('SESSION_LIFETIME', 120), 'ex
------------------- | Session Lifetime |-------------------------------------------------------------------------- | | Here you may specify the number of minutes that you wish the session | to be allowed to re
{ "filepath": "config/session.php", "language": "php", "file_size": 7849, "cut_index": 716, "middle_length": 229 }
?php return [ /* |-------------------------------------------------------------------------- | View Storage Paths |-------------------------------------------------------------------------- | | Most templating systems load templates from disk. Here you may specify | an array of paths that ...
l the compiled Blade templates will be | stored for your application. Typically, this is within the storage | directory. However, as usual, you are free to change this value. | */ 'compiled' => env( 'VIEW_COMPILED_PATH',
|-------------------------------------------------------------------------- | Compiled View Path |-------------------------------------------------------------------------- | | This option determines where al
{ "filepath": "config/view.php", "language": "php", "file_size": 1053, "cut_index": 513, "middle_length": 229 }
te\Tests\Pagination; use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Pagination\CursorPaginator; use Illuminate\Tests\Pagination\Fixtures\Models\CursorResourceTestModel; use PHPUnit\Framework\TestCase; class CursorResourceTest extends TestCase { public function testItCanTransformToExplicitResource...
$this->expectExceptionMessage('Failed to find resource class for model [Illuminate\Tests\Pagination\Fixtures\Models\CursorResourceTestModel].'); $paginator = new CursorResourceTestPaginator([ new CursorResourceTestModel(), ]
stResource::class); $this->assertInstanceOf(JsonResource::class, $resource); } public function testItThrowsExceptionWhenResourceCannotBeFound() { $this->expectException(\LogicException::class);
{ "filepath": "tests/Pagination/CursorResourceTest.php", "language": "php", "file_size": 1670, "cut_index": 537, "middle_length": 229 }
Unit\Framework\TestCase; class LengthAwarePaginatorTest extends TestCase { /** * @var \Illuminate\Pagination\LengthAwarePaginator */ private $p; /** * @var array */ private $options; protected function setUp(): void { $this->options = ['onEachSide' => 5]; $...
this->p->getPageName()); } public function testLengthAwarePaginatorCanGiveMeRelevantPageInformation() { $this->assertEquals(2, $this->p->lastPage()); $this->assertEquals(2, $this->p->currentPage()); $this->assertTrue($t
parent::tearDown(); } public function testLengthAwarePaginatorGetAndSetPageName() { $this->assertSame('page', $this->p->getPageName()); $this->p->setPageName('p'); $this->assertSame('p', $
{ "filepath": "tests/Pagination/LengthAwarePaginatorTest.php", "language": "php", "file_size": 4242, "cut_index": 614, "middle_length": 229 }
te\Tests\Pagination; use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Tests\Pagination\Fixtures\Models\PaginatorResourceTestModel; use PHPUnit\Framework\TestCase; class PaginatorResourceTest extends TestCase { public function testItCanTransformToExpli...
icException::class); $this->expectExceptionMessage('Failed to find resource class for model [Illuminate\Tests\Pagination\Fixtures\Models\PaginatorResourceTestModel].'); $paginator = new PaginatorResourceTestPaginator([ new Pagi
ection(PaginatorResourceTestResource::class); $this->assertInstanceOf(JsonResource::class, $resource); } public function testItThrowsExceptionWhenResourceCannotBeFound() { $this->expectException(\Log
{ "filepath": "tests/Pagination/PaginatorResourceTest.php", "language": "php", "file_size": 1740, "cut_index": 537, "middle_length": 229 }
<?php namespace Illuminate\Tests\Foundation\Console; use Illuminate\Events\Dispatcher; use Illuminate\Foundation\Application; use Illuminate\Foundation\Console\Kernel; use Illuminate\Foundation\Events\Terminating; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\StringInput; class KernelTest exten...
tion () use (&$called) { $called[] = 'terminating callback'; }); $kernel->terminate(new StringInput('tinker'), 0); $this->assertSame([ 'terminating event', 'terminating callback', ], $ca
'events', $events); $kernel = new Kernel($app, $events); $events->listen(function (Terminating $terminating) use (&$called) { $called[] = 'terminating event'; }); $app->terminating(func
{ "filepath": "tests/Foundation/Console/KernelTest.php", "language": "php", "file_size": 1012, "cut_index": 512, "middle_length": 229 }
re\TransformsRequest; use Illuminate\Http\Request; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request as SymfonyRequest; class TransformsRequestTest extends TestCase { public function testTransformOncePerKeyWhenMethodIsGet() { $middleware = new TruncateInput; $symfonyR...
} public function testTransformOncePerKeyWhenMethodIsPost() { $middleware = new ManipulateInput; $symfonyRequest = new SymfonyRequest( [ 'name' => 'Damian', 'beers' => 4,
ateFromBase($symfonyRequest); $middleware->handle($request, function (Request $request) { $this->assertSame('12', $request->get('bar')); $this->assertSame('ab', $request->get('baz')); });
{ "filepath": "tests/Foundation/Http/Middleware/TransformsRequestTest.php", "language": "php", "file_size": 3815, "cut_index": 614, "middle_length": 229 }