Skip to content

Commit d7cdf5c

Browse files
committed
Merge branch '9.x'
# Conflicts: # CHANGELOG.md # src/Illuminate/Foundation/Application.php
2 parents 18c926d + b154d43 commit d7cdf5c

File tree

8 files changed

+81
-14
lines changed

8 files changed

+81
-14
lines changed

.github/workflows/static-analysis.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ jobs:
4747

4848
name: Facade DocBlocks
4949

50+
if: ${{ github.repository_owner == 'laravel' && github.event_name == 'push' }}
51+
5052
steps:
5153
- name: Checkout code
5254
uses: actions/checkout@v3
@@ -65,5 +67,11 @@ jobs:
6567
max_attempts: 5
6668
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress
6769

68-
- name: Lint facade docblocks
69-
run: php -f bin/facades.php -- --lint
70+
- name: Update facade docblocks
71+
run: php -f bin/facades.php
72+
73+
- name: Commit facade docblocks
74+
uses: stefanzweifel/git-auto-commit-action@v4
75+
with:
76+
commit_message: Update facade docblocks
77+
file_pattern: src/

.github/workflows/tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
AWS_SECRET_ACCESS_KEY: random_secret
9595

9696
- name: Store artifacts
97-
uses: actions/upload-artifact@v2
97+
uses: actions/upload-artifact@v3
9898
with:
9999
name: logs
100100
path: |
@@ -167,7 +167,7 @@ jobs:
167167
AWS_SECRET_ACCESS_KEY: random_secret
168168

169169
- name: Store artifacts
170-
uses: actions/upload-artifact@v2
170+
uses: actions/upload-artifact@v3
171171
with:
172172
name: logs
173173
path: |

src/Illuminate/Collections/helpers.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue>|null $value
1414
* @return \Illuminate\Support\Collection<TKey, TValue>
1515
*/
16-
function collect($value = null)
16+
function collect($value = [])
1717
{
1818
return new Collection($value);
1919
}

src/Illuminate/Database/Schema/SqliteSchemaState.php

+6
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ protected function appendMigrationData(string $path)
6161
*/
6262
public function load($path)
6363
{
64+
if ($this->connection->getDatabaseName() === ':memory:') {
65+
$this->connection->getPdo()->exec($this->files->get($path));
66+
67+
return;
68+
}
69+
6470
$process = $this->makeProcess($this->baseCommand().' < "${:LARAVEL_LOAD_PATH}"');
6571

6672
$process->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [

src/Illuminate/Routing/RouteRegistrar.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function apiSingleton($name, $controller, array $options = [])
184184
/**
185185
* Create a route group with shared attributes.
186186
*
187-
* @param \Closure|string $callback
187+
* @param \Closure|array|string $callback
188188
* @return $this
189189
*/
190190
public function group($callback)

src/Illuminate/View/Compilers/BladeCompiler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ protected function storeVerbatimBlocks($value)
387387
*/
388388
protected function storePhpBlocks($value)
389389
{
390-
return preg_replace_callback('/(?<!@)@php(?! ?\()(.*?)@endphp/s', function ($matches) {
390+
return preg_replace_callback('/(?<!@)@php(.*?)@endphp/s', function ($matches) {
391391
return $this->storeRawBlock("<?php{$matches[1]}?>");
392392
}, $value);
393393
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
namespace Illuminate\Tests\Database;
4+
5+
use Illuminate\Database\Schema\SqliteSchemaState;
6+
use Illuminate\Database\SQLiteConnection;
7+
use Illuminate\Filesystem\Filesystem;
8+
use Mockery as m;
9+
use PDO;
10+
use PHPUnit\Framework\TestCase;
11+
use Symfony\Component\Process\Process;
12+
13+
class DatabaseSqliteSchemaStateTest extends TestCase
14+
{
15+
protected function tearDown(): void
16+
{
17+
parent::tearDown();
18+
m::close();
19+
}
20+
21+
public function testLoadSchemaToDatabase(): void
22+
{
23+
$config = ['driver' => 'sqlite', 'database' => 'database/database.sqlite', 'prefix' => '', 'foreign_key_constraints' => true, 'name' => 'sqlite'];
24+
$connection = m::mock(SQLiteConnection::class);
25+
$connection->shouldReceive('getConfig')->andReturn($config);
26+
$connection->shouldReceive('getDatabaseName')->andReturn($config['database']);
27+
28+
$process = m::spy(Process::class);
29+
$processFactory = m::spy(function () use ($process) {
30+
return $process;
31+
});
32+
33+
$schemaState = new SqliteSchemaState($connection, null, $processFactory);
34+
$schemaState->load('database/schema/sqlite-schema.dump');
35+
36+
$processFactory->shouldHaveBeenCalled()->with('sqlite3 "${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"');
37+
38+
$process->shouldHaveReceived('mustRun')->with(null, [
39+
'LARAVEL_LOAD_DATABASE' => 'database/database.sqlite',
40+
'LARAVEL_LOAD_PATH' => 'database/schema/sqlite-schema.dump',
41+
]);
42+
}
43+
44+
public function testLoadSchemaToInMemory(): void
45+
{
46+
$config = ['driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '', 'foreign_key_constraints' => true, 'name' => 'sqlite'];
47+
$connection = m::mock(SQLiteConnection::class);
48+
$connection->shouldReceive('getConfig')->andReturn($config);
49+
$connection->shouldReceive('getDatabaseName')->andReturn($config['database']);
50+
$connection->shouldReceive('getPdo')->andReturn($pdo = m::spy(PDO::class));
51+
52+
$files = m::mock(Filesystem::class);
53+
$files->shouldReceive('get')->andReturn('CREATE TABLE IF NOT EXISTS "migrations" ("id" integer not null primary key autoincrement, "migration" varchar not null, "batch" integer not null);');
54+
55+
$schemaState = new SqliteSchemaState($connection, $files);
56+
$schemaState->load('database/schema/sqlite-schema.dump');
57+
58+
$pdo->shouldHaveReceived('exec')->with('CREATE TABLE IF NOT EXISTS "migrations" ("id" integer not null primary key autoincrement, "migration" varchar not null, "batch" integer not null);');
59+
}
60+
}

tests/View/Blade/BladePhpStatementsTest.php

-7
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,4 @@ public function testStringWithEscapingDataValue()
8484

8585
$this->assertEquals($expected, $this->compiler->compileString($string));
8686
}
87-
88-
public function testCompilationOfMixedPhpStatements()
89-
{
90-
$string = '@php($set = true) @php ($hello = \'hi\') @php echo "Hello world" @endphp';
91-
$expected = '<?php ($set = true); ?> <?php ($hello = \'hi\'); ?> <?php echo "Hello world" ?>';
92-
$this->assertEquals($expected, $this->compiler->compileString($string));
93-
}
9487
}

0 commit comments

Comments
 (0)