Skip to content

Commit ba217b9

Browse files
committed
fix conflicts
2 parents f2052c9 + a2668ed commit ba217b9

File tree

10 files changed

+97
-43
lines changed

10 files changed

+97
-43
lines changed

CHANGELOG-7.x.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
# Release Notes for 7.x
22

3-
## [Unreleased](https://github.com/laravel/framework/compare/v7.12.0...7.x)
3+
## [Unreleased](https://github.com/laravel/framework/compare/v7.13.0...7.x)
4+
5+
### Fixed
6+
- Restore `app()->getCached*Path()` absolute '/' behavior in Windows ([#32969](https://github.com/laravel/framework/pull/32969))
7+
8+
9+
## [v7.13.0 (2020-05-26)](https://github.com/laravel/framework/compare/v7.12.0...v7.13.0)
10+
11+
### Added
12+
- Added `Illuminate\Pagination\AbstractPaginator::useTailwind()` ([2279b73](https://github.com/laravel/framework/commit/2279b73d5553c34c970128264a248f3bb57afad6), [bf1eef4](https://github.com/laravel/framework/commit/bf1eef400951dcee04839a9ab7c15da1a807f89c), [13a9ec3](https://github.com/laravel/framework/commit/13a9ec349b8bcaa31d1757752ae0304f0328e5ce))
13+
14+
### Fixed
15+
- Fixed route list command for excluded middleware ([7ebd211](https://github.com/laravel/framework/commit/7ebd21193df520d78269d7abd740537a2fae889e))
16+
- Fixed behavior of oneachside = 1 with paginator in `Illuminate\Pagination\UrlWindow` ([c59cffa](https://github.com/laravel/framework/commit/c59cffa7825498e1d419d8c86cd8527520f718cb), [5d817be](https://github.com/laravel/framework/commit/5d817bef236559cc9368e1ec4ceafa8a790f751d))
17+
18+
### Changed
19+
- Using an indexed array as the limit modifier for phpredis zrangebyscore ([#32952](https://github.com/laravel/framework/pull/32952))
420

521

622
## [v7.12.0 (2020-05-19)](https://github.com/laravel/framework/compare/v7.11.0...v7.12.0)

src/Illuminate/Foundation/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
152152
*
153153
* @var array
154154
*/
155-
protected $absoluteCachePathPrefixes = [DIRECTORY_SEPARATOR];
155+
protected $absoluteCachePathPrefixes = ['/', '\\'];
156156

157157
/**
158158
* Create a new Illuminate application instance.

src/Illuminate/Pagination/UrlWindow.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function get()
4444
{
4545
$onEachSide = $this->paginator->onEachSide;
4646

47-
if ($this->paginator->lastPage() < ($onEachSide * 2) + 6) {
47+
if ($this->paginator->lastPage() < ($onEachSide * 2) + 8) {
4848
return $this->getSmallSlider();
4949
}
5050

@@ -73,7 +73,7 @@ protected function getSmallSlider()
7373
*/
7474
protected function getUrlSlider($onEachSide)
7575
{
76-
$window = $onEachSide * 2;
76+
$window = $onEachSide + 4;
7777

7878
if (! $this->hasPages()) {
7979
return ['first' => null, 'slider' => null, 'last' => null];
@@ -83,14 +83,14 @@ protected function getUrlSlider($onEachSide)
8383
// just render the beginning of the page range, followed by the last 2 of the
8484
// links in this list, since we will not have room to create a full slider.
8585
if ($this->currentPage() <= $window) {
86-
return $this->getSliderTooCloseToBeginning($window);
86+
return $this->getSliderTooCloseToBeginning($window, $onEachSide);
8787
}
8888

8989
// If the current page is close to the ending of the page range we will just get
9090
// this first couple pages, followed by a larger window of these ending pages
9191
// since we're too close to the end of the list to create a full on slider.
9292
elseif ($this->currentPage() > ($this->lastPage() - $window)) {
93-
return $this->getSliderTooCloseToEnding($window);
93+
return $this->getSliderTooCloseToEnding($window, $onEachSide);
9494
}
9595

9696
// If we have enough room on both sides of the current page to build a slider we
@@ -103,12 +103,13 @@ protected function getUrlSlider($onEachSide)
103103
* Get the slider of URLs when too close to beginning of window.
104104
*
105105
* @param int $window
106+
* @param int $onEachSide
106107
* @return array
107108
*/
108-
protected function getSliderTooCloseToBeginning($window)
109+
protected function getSliderTooCloseToBeginning($window, $onEachSide)
109110
{
110111
return [
111-
'first' => $this->paginator->getUrlRange(1, $window + 2),
112+
'first' => $this->paginator->getUrlRange(1, $window + $onEachSide),
112113
'slider' => null,
113114
'last' => $this->getFinish(),
114115
];
@@ -118,12 +119,13 @@ protected function getSliderTooCloseToBeginning($window)
118119
* Get the slider of URLs when too close to ending of window.
119120
*
120121
* @param int $window
122+
* @param int $onEachSide
121123
* @return array
122124
*/
123-
protected function getSliderTooCloseToEnding($window)
125+
protected function getSliderTooCloseToEnding($window, $onEachSide)
124126
{
125127
$last = $this->paginator->getUrlRange(
126-
$this->lastPage() - ($window + 2),
128+
$this->lastPage() - ($window + ($onEachSide - 1)),
127129
$this->lastPage()
128130
);
129131

src/Illuminate/Redis/Connections/PhpRedisConnection.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Closure;
66
use Illuminate\Contracts\Redis\Connection as ConnectionContract;
7+
use Illuminate\Support\Arr;
78
use Illuminate\Support\Str;
89
use Redis;
910
use RedisCluster;
@@ -240,7 +241,7 @@ public function zadd($key, ...$dictionary)
240241
*/
241242
public function zrangebyscore($key, $min, $max, $options = [])
242243
{
243-
if (isset($options['limit'])) {
244+
if (isset($options['limit']) && Arr::isAssoc($options['limit'])) {
244245
$options['limit'] = [
245246
$options['limit']['offset'],
246247
$options['limit']['count'],
@@ -261,7 +262,7 @@ public function zrangebyscore($key, $min, $max, $options = [])
261262
*/
262263
public function zrevrangebyscore($key, $min, $max, $options = [])
263264
{
264-
if (isset($options['limit'])) {
265+
if (isset($options['limit']) && Arr::isAssoc($options['limit'])) {
265266
$options['limit'] = [
266267
$options['limit']['offset'],
267268
$options['limit']['count'],

src/Illuminate/View/Component.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,18 @@ public function resolveView()
6666
return $view;
6767
}
6868

69-
$factory = Container::getInstance()->make('view');
69+
$resolver = function ($view) {
70+
$factory = Container::getInstance()->make('view');
7071

71-
return $factory->exists($view)
72-
? $view
73-
: $this->createBladeViewFromString($factory, $view);
72+
return $factory->exists($view)
73+
? $view
74+
: $this->createBladeViewFromString($factory, $view);
75+
};
76+
77+
return $view instanceof Closure ? function (array $data = []) use ($view, $resolver) {
78+
return $resolver($view($data));
79+
}
80+
: $resolver($view);
7481
}
7582

7683
/**

src/Illuminate/View/Concerns/ManagesComponents.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Illuminate\View\Concerns;
44

5+
use Closure;
56
use Illuminate\Collections\Arr;
67
use Illuminate\Support\HtmlString;
78
use Illuminate\View\View;
@@ -40,7 +41,7 @@ trait ManagesComponents
4041
/**
4142
* Start a component rendering process.
4243
*
43-
* @param \Illuminate\View\View|string $view
44+
* @param \Illuminate\View\View|\Closure|string $view
4445
* @param array $data
4546
* @return void
4647
*/
@@ -80,10 +81,16 @@ public function renderComponent()
8081
{
8182
$view = array_pop($this->componentStack);
8283

84+
$data = $this->componentData();
85+
86+
if ($view instanceof Closure) {
87+
$view = $view($data);
88+
}
89+
8390
if ($view instanceof View) {
84-
return $view->with($this->componentData())->render();
91+
return $view->with($data)->render();
8592
} else {
86-
return $this->make($view, $this->componentData())->render();
93+
return $this->make($view, $data)->render();
8794
}
8895
}
8996

tests/Http/HttpClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public function testSequenceBuilder()
250250
$this->assertSame(200, $response->status());
251251

252252
$response = $this->factory->get('https://example.com');
253-
$this->assertSame('This is a story about something that happened long ago when your grandfather was a child.'.PHP_EOL, $response->body());
253+
$this->assertSame("This is a story about something that happened long ago when your grandfather was a child.\n", $response->body());
254254
$this->assertSame(200, $response->status());
255255

256256
$response = $this->factory->get('https://example.com');

tests/Pagination/UrlWindowTest.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,38 @@ public function testPresenterCanGetAUrlRangeForASmallNumberOfUrls()
2525
public function testPresenterCanGetAUrlRangeForAWindowOfLinks()
2626
{
2727
$array = [];
28-
for ($i = 1; $i <= 13; $i++) {
28+
for ($i = 1; $i <= 20; $i++) {
2929
$array[$i] = 'item'.$i;
3030
}
31-
$p = new LengthAwarePaginator($array, count($array), 1, 7);
31+
$p = new LengthAwarePaginator($array, count($array), 1, 12);
3232
$window = new UrlWindow($p);
3333
$slider = [];
34-
for ($i = 4; $i <= 10; $i++) {
34+
for ($i = 9; $i <= 15; $i++) {
3535
$slider[$i] = '/?page='.$i;
3636
}
3737

38-
$this->assertEquals(['first' => [1 => '/?page=1', 2 => '/?page=2'], 'slider' => $slider, 'last' => [12 => '/?page=12', 13 => '/?page=13']], $window->get());
38+
$this->assertEquals(['first' => [1 => '/?page=1', 2 => '/?page=2'], 'slider' => $slider, 'last' => [19 => '/?page=19', 20 => '/?page=20']], $window->get());
3939

4040
/*
4141
* Test Being Near The End Of The List
4242
*/
43-
$p = new LengthAwarePaginator($array, count($array), 1, 8);
43+
$array = [];
44+
for ($i = 1; $i <= 20; $i++) {
45+
$array[$i] = 'item'.$i;
46+
}
47+
$p = new LengthAwarePaginator($array, count($array), 1, 17);
4448
$window = new UrlWindow($p);
4549
$last = [];
46-
for ($i = 5; $i <= 13; $i++) {
50+
for ($i = 11; $i <= 20; $i++) {
4751
$last[$i] = '/?page='.$i;
4852
}
49-
5053
$this->assertEquals(['first' => [1 => '/?page=1', 2 => '/?page=2'], 'slider' => null, 'last' => $last], $window->get());
5154
}
5255

5356
public function testCustomUrlRangeForAWindowOfLinks()
5457
{
5558
$array = [];
56-
for ($i = 1; $i <= 13; $i++) {
59+
for ($i = 1; $i <= 20; $i++) {
5760
$array[$i] = 'item'.$i;
5861
}
5962

@@ -66,6 +69,6 @@ public function testCustomUrlRangeForAWindowOfLinks()
6669
$slider[$i] = '/?page='.$i;
6770
}
6871

69-
$this->assertEquals(['first' => [1 => '/?page=1', 2 => '/?page=2'], 'slider' => $slider, 'last' => [12 => '/?page=12', 13 => '/?page=13']], $window->get());
72+
$this->assertEquals(['first' => [1 => '/?page=1', 2 => '/?page=2'], 'slider' => $slider, 'last' => [19 => '/?page=19', 20 => '/?page=20']], $window->get());
7073
}
7174
}

tests/Queue/QueueWorkerTest.php

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,21 @@ public function testWorkerCanWorkUntilQueueIsEmpty()
5959
$secondJob = new WorkerFakeJob,
6060
]]);
6161

62-
$this->expectException(LoopBreakerException::class);
62+
try {
63+
$worker->daemon('default', 'queue', $workerOptions);
6364

64-
$worker->daemon('default', 'queue', $workerOptions);
65+
$this->fail('Expected LoopBreakerException to be thrown.');
66+
} catch (LoopBreakerException $e) {
67+
$this->assertTrue($firstJob->fired);
6568

66-
$this->assertTrue($firstJob->fired);
69+
$this->assertTrue($secondJob->fired);
6770

68-
$this->assertTrue($secondJob->fired);
71+
$this->assertSame(0, $worker->stoppedWithStatus);
6972

70-
$this->assertSame(0, $worker->stoppedWithStatus);
73+
$this->events->shouldHaveReceived('dispatch')->with(m::type(JobProcessing::class))->twice();
7174

72-
$this->events->shouldHaveReceived('dispatch')->with(m::type(JobProcessing::class))->twice();
73-
74-
$this->events->shouldHaveReceived('dispatch')->with(m::type(JobProcessed::class))->twice();
75+
$this->events->shouldHaveReceived('dispatch')->with(m::type(JobProcessed::class))->twice();
76+
}
7577
}
7678

7779
public function testJobCanBeFiredBasedOnPriority()
@@ -276,21 +278,23 @@ public function testJobRunsIfAppIsNotInMaintenanceMode()
276278

277279
$maintenanceModeChecker = function () {
278280
if ($this->maintenanceFlags) {
279-
return array_pop($this->maintenanceFlags);
281+
return array_shift($this->maintenanceFlags);
280282
}
281283

282284
throw new LoopBreakerException;
283285
};
284286

285-
$this->expectException(LoopBreakerException::class);
286-
287287
$worker = $this->getWorker('default', ['queue' => [$firstJob, $secondJob]], $maintenanceModeChecker);
288288

289-
$worker->daemon('default', 'queue', $this->workerOptions());
289+
try {
290+
$worker->daemon('default', 'queue', $this->workerOptions());
290291

291-
$this->assertEquals($firstJob->attempts, 1);
292+
$this->fail('Expected LoopBreakerException to be thrown');
293+
} catch (LoopBreakerException $e) {
294+
$this->assertSame(1, $firstJob->attempts);
292295

293-
$this->assertEquals($firstJob->attempts, 0);
296+
$this->assertSame(0, $secondJob->attempts);
297+
}
294298
}
295299

296300
public function testJobDoesNotFireIfDeleted()
@@ -380,6 +384,7 @@ private function workerOptions(array $overrides = [])
380384
class InsomniacWorker extends Worker
381385
{
382386
public $sleptFor;
387+
public $stopOnMemoryExceeded = false;
383388

384389
public function sleep($seconds)
385390
{
@@ -397,6 +402,11 @@ public function daemonShouldRun(WorkerOptions $options, $connectionName, $queue)
397402
{
398403
return ! ($this->isDownForMaintenance)();
399404
}
405+
406+
public function memoryExceeded($memoryLimit)
407+
{
408+
return $this->stopOnMemoryExceeded;
409+
}
400410
}
401411

402412
class WorkerFakeManager extends QueueManager

tests/Redis/RedisConnectionTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,10 @@ public function testItReturnsRangeByScoreInSortedSet()
329329
'count' => 2,
330330
],
331331
]));
332+
$this->assertEquals(['matt' => 5, 'taylor' => 10], $redis->zrangebyscore('set', 0, 11, [
333+
'withscores' => true,
334+
'limit' => [1, 2],
335+
]));
332336

333337
$redis->flushall();
334338
}
@@ -346,6 +350,10 @@ public function testItReturnsRevRangeByScoreInSortedSet()
346350
'count' => 2,
347351
],
348352
]));
353+
$this->assertEquals(['matt' => 5, 'jeffrey' => 1], $redis->ZREVRANGEBYSCORE('set', 10, 0, [
354+
'withscores' => true,
355+
'limit' => [1, 2],
356+
]));
349357

350358
$redis->flushall();
351359
}

0 commit comments

Comments
 (0)