1
0
mirror of https://github.com/flarum/core.git synced 2025-08-04 15:37:51 +02:00
This commit is contained in:
Sami Mazouz
2024-06-21 10:25:02 +01:00
parent 7504e31399
commit a03104d61d
4 changed files with 14 additions and 6 deletions

View File

@@ -192,7 +192,7 @@ class Serializer extends \Tobyz\JsonApiServer\Serializer
$deferred = $this->deferred; $deferred = $this->deferred;
/** @var Closure $resolve */ /** @var Closure $resolve */
while ($resolve = $deferred->shift()) { while (($resolve = $deferred->shift()) && is_callable($resolve)) {
$resolve(); $resolve();
} }

View File

@@ -12,7 +12,9 @@ namespace Flarum\Frontend\Compiler;
use Flarum\Frontend\Compiler\Source\FileSource; use Flarum\Frontend\Compiler\Source\FileSource;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Less_FileManager;
use Less_Parser; use Less_Parser;
use Less_Tree_Import;
/** /**
* @internal * @internal
@@ -129,8 +131,10 @@ class LessCompiler extends RevisionCompiler
]; ];
})->unique('path'); })->unique('path');
return function ($evald) use ($baseSources): ?array { return function (Less_Tree_Import $evald) use ($baseSources): ?array {
$relativeImportPath = Str::of($evald->PathAndUri()[0])->split('/\/less\//'); $pathAndUri = Less_FileManager::getFilePath($evald->getPath(), $evald->currentFileInfo);
$relativeImportPath = Str::of($pathAndUri[0])->split('/\/less\//');
$extensionId = $baseSources->where('path', $relativeImportPath->first())->pluck('extensionId')->first(); $extensionId = $baseSources->where('path', $relativeImportPath->first())->pluck('extensionId')->first();
$overrideImport = $this->lessImportOverrides $overrideImport = $this->lessImportOverrides
@@ -141,7 +145,7 @@ class LessCompiler extends RevisionCompiler
return null; return null;
} }
return [$overrideImport['newFilePath'], $evald->PathAndUri()[1]]; return [$overrideImport['newFilePath'], $pathAndUri[1]];
}; };
} }

View File

@@ -209,7 +209,7 @@ class CreateTest extends TestCase
*/ */
public function discussion_creation_limited_by_throttler() public function discussion_creation_limited_by_throttler()
{ {
$this->send( $response = $this->send(
$this->request('POST', '/api/discussions', [ $this->request('POST', '/api/discussions', [
'authenticatedAs' => 2, 'authenticatedAs' => 2,
'json' => [ 'json' => [
@@ -224,6 +224,8 @@ class CreateTest extends TestCase
]) ])
); );
$this->assertEquals(201, $response->getStatusCode());
$response = $this->send( $response = $this->send(
$this->request('POST', '/api/discussions', [ $this->request('POST', '/api/discussions', [
'authenticatedAs' => 2, 'authenticatedAs' => 2,

View File

@@ -104,7 +104,7 @@ class CreateTest extends TestCase
*/ */
public function limited_by_throttler() public function limited_by_throttler()
{ {
$this->send( $response = $this->send(
$this->request('POST', '/api/posts', [ $this->request('POST', '/api/posts', [
'authenticatedAs' => 2, 'authenticatedAs' => 2,
'json' => [ 'json' => [
@@ -121,6 +121,8 @@ class CreateTest extends TestCase
]) ])
); );
$this->assertEquals(201, $response->getStatusCode(), (string) $response->getBody());
$response = $this->send( $response = $this->send(
$this->request('POST', '/api/posts', [ $this->request('POST', '/api/posts', [
'authenticatedAs' => 2, 'authenticatedAs' => 2,