Skip to content

Commit 0aceb68

Browse files
Merge branch '7.x'
2 parents b802c98 + c99273d commit 0aceb68

File tree

9 files changed

+74
-16
lines changed

9 files changed

+74
-16
lines changed

CHANGELOG-6.x.md

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

3-
## [Unreleased](https://github.com/laravel/framework/compare/v6.18.15...6.x)
3+
## [Unreleased](https://github.com/laravel/framework/compare/v6.18.16...6.x)
44

55

66
## [v6.18.15 (2020-05-19)](https://github.com/laravel/framework/compare/v6.18.14...v6.18.15)

tests/Console/Scheduling/EventTest.php

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,54 @@ protected function tearDown(): void
1414
m::close();
1515
}
1616

17-
public function testBuildCommand()
17+
public function testBuildCommandUsingUnix()
1818
{
19-
$isWindows = DIRECTORY_SEPARATOR == '\\';
20-
$quote = ($isWindows) ? '"' : "'";
19+
if (windows_os()) {
20+
$this->markTestSkipped('Skipping since operating system is Windows');
21+
}
2122

2223
$event = new Event(m::mock(EventMutex::class), 'php -i');
2324

24-
$defaultOutput = ($isWindows) ? 'NUL' : '/dev/null';
25-
$this->assertSame("php -i > {$quote}{$defaultOutput}{$quote} 2>&1", $event->buildCommand());
25+
$this->assertSame("php -i > '/dev/null' 2>&1", $event->buildCommand());
26+
}
27+
28+
public function testBuildCommandUsingWindows()
29+
{
30+
if (! windows_os()) {
31+
$this->markTestSkipped('Skipping since operating system is not Windows');
32+
}
33+
34+
$event = new Event(m::mock(EventMutex::class), 'php -i');
35+
36+
$this->assertSame('php -i > "NUL" 2>&1', $event->buildCommand());
37+
}
38+
39+
public function testBuildCommandInBackgroundUsingUnix()
40+
{
41+
if (windows_os()) {
42+
$this->markTestSkipped('Skipping since operating system is Windows');
43+
}
2644

2745
$event = new Event(m::mock(EventMutex::class), 'php -i');
2846
$event->runInBackground();
2947

30-
$commandSeparator = ($isWindows ? '&' : ';');
3148
$scheduleId = '"framework'.DIRECTORY_SEPARATOR.'schedule-eeb46c93d45e928d62aaf684d727e213b7094822"';
32-
$this->assertSame("(php -i > {$quote}{$defaultOutput}{$quote} 2>&1 {$commandSeparator} {$quote}".PHP_BINARY."{$quote} artisan schedule:finish {$scheduleId} \"$?\") > {$quote}{$defaultOutput}{$quote} 2>&1 &", $event->buildCommand());
49+
50+
$this->assertSame("(php -i > '/dev/null' 2>&1 ; '".PHP_BINARY."' artisan schedule:finish {$scheduleId} \"$?\") > '/dev/null' 2>&1 &", $event->buildCommand());
51+
}
52+
53+
public function testBuildCommandInBackgroundUsingWindows()
54+
{
55+
if (! windows_os()) {
56+
$this->markTestSkipped('Skipping since operating system is not Windows');
57+
}
58+
59+
$event = new Event(m::mock(EventMutex::class), 'php -i');
60+
$event->runInBackground();
61+
62+
$scheduleId = '"framework'.DIRECTORY_SEPARATOR.'schedule-eeb46c93d45e928d62aaf684d727e213b7094822"';
63+
64+
$this->assertSame('start /b cmd /c "(php -i & "'.PHP_BINARY.'" artisan schedule:finish '.$scheduleId.' "%errorlevel%") > "NUL" 2>&1"', $event->buildCommand());
3365
}
3466

3567
public function testBuildCommandSendOutputTo()

tests/Filesystem/FilesystemAdapterTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,10 @@ public function testPutWithStreamInterface()
236236
$spy = m::spy($this->filesystem);
237237

238238
$filesystemAdapter = new FilesystemAdapter($spy);
239-
$stream = new Stream(fopen($this->tempDir.'/foo.txt', 'r'));
240-
$filesystemAdapter->put('bar.txt', $stream);
239+
$stream = fopen($this->tempDir.'/foo.txt', 'r');
240+
$guzzleStream = new Stream($stream);
241+
$filesystemAdapter->put('bar.txt', $guzzleStream);
242+
fclose($stream);
241243

242244
$spy->shouldHaveReceived('putStream');
243245
$this->assertSame('some-data', $filesystemAdapter->get('bar.txt'));

tests/Filesystem/FilesystemTest.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,22 @@ public function testPutStoresFiles()
4343
$this->assertStringEqualsFile($this->tempDir.'/file.txt', 'Hello World');
4444
}
4545

46-
public function testReplaceStoresFiles()
46+
public function testReplaceCreatesFile()
4747
{
48+
$tempFile = "{$this->tempDir}/file.txt";
49+
50+
$filesystem = new Filesystem;
51+
52+
$filesystem->replace($tempFile, 'Hello World');
53+
$this->assertStringEqualsFile($tempFile, 'Hello World');
54+
}
55+
56+
public function testReplaceWhenUnixSymlinkExists()
57+
{
58+
if (windows_os()) {
59+
$this->markTestSkipped('Skipping since operating system is Windows');
60+
}
61+
4862
$tempFile = "{$this->tempDir}/file.txt";
4963
$symlinkDir = "{$this->tempDir}/symlink_dir";
5064
$symlink = "{$symlinkDir}/symlink.txt";

tests/Foundation/Bootstrap/LoadEnvironmentVariablesTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ class LoadEnvironmentVariablesTest extends TestCase
1111
{
1212
protected function tearDown(): void
1313
{
14+
unset($_ENV['FOO']);
15+
unset($_SERVER['FOO']);
16+
putenv('FOO');
1417
m::close();
1518
}
1619

tests/Foundation/FoundationApplicationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ public function testEnvPathsAreUsedForCachePathsWhenSpecified()
376376
$_SERVER['APP_ROUTES_CACHE'] = '/absolute/path/routes.php';
377377
$_SERVER['APP_EVENTS_CACHE'] = '/absolute/path/events.php';
378378

379+
$ds = DIRECTORY_SEPARATOR;
379380
$this->assertSame('/absolute/path/services.php', $app->getCachedServicesPath());
380381
$this->assertSame('/absolute/path/packages.php', $app->getCachedPackagesPath());
381382
$this->assertSame('/absolute/path/config.php', $app->getCachedConfigPath());

tests/Integration/Mail/RenderingMailWithLocaleTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ public function testMailableRendersInDefaultLocale()
3131
{
3232
$mail = new RenderedTestMail;
3333

34-
$this->assertStringContainsString('name'.PHP_EOL, $mail->render());
34+
$this->assertStringContainsString('name', $mail->render());
3535
}
3636

3737
public function testMailableRendersInSelectedLocale()
3838
{
3939
$mail = (new RenderedTestMail)->locale('es');
4040

41-
$this->assertStringContainsString('nombre'.PHP_EOL, $mail->render());
41+
$this->assertStringContainsString('nombre', $mail->render());
4242
}
4343

4444
public function testMailableRendersInAppSelectedLocale()
@@ -47,7 +47,7 @@ public function testMailableRendersInAppSelectedLocale()
4747

4848
$mail = new RenderedTestMail;
4949

50-
$this->assertStringContainsString('nombre'.PHP_EOL, $mail->render());
50+
$this->assertStringContainsString('nombre', $mail->render());
5151
}
5252
}
5353

tests/Queue/RedisQueueIntegrationTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,20 @@ public function testExpiredJobsArePopped($driver)
6868

6969
/**
7070
* @dataProvider redisDriverProvider
71+
* @requires extension pcntl
7172
*
7273
* @param mixed $driver
7374
*
7475
* @throws \Exception
7576
*/
7677
public function testBlockingPop($driver)
7778
{
79+
if (! function_exists('pcntl_fork')) {
80+
$this->markTestSkipped('Skipping since the pcntl extension is not available');
81+
}
82+
7883
$this->tearDownRedis();
84+
7985
if ($pid = pcntl_fork() > 0) {
8086
$this->setUpRedis();
8187
$this->setQueue($driver, 'default', null, 60, 10);

tests/Support/SupportHelpersTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ public function testRetry()
492492
$this->assertEquals(2, $attempts);
493493

494494
// Make sure we waited 100ms for the first attempt
495-
$this->assertTrue(microtime(true) - $startTime >= 0.1);
495+
$this->assertEqualsWithDelta(0.1, microtime(true) - $startTime, 0.01);
496496
}
497497

498498
public function testRetryWithPassingWhenCallback()
@@ -513,7 +513,7 @@ public function testRetryWithPassingWhenCallback()
513513
$this->assertEquals(2, $attempts);
514514

515515
// Make sure we waited 100ms for the first attempt
516-
$this->assertTrue(microtime(true) - $startTime >= 0.1);
516+
$this->assertEqualsWithDelta(0.1, microtime(true) - $startTime, 0.01);
517517
}
518518

519519
public function testRetryWithFailingWhenCallback()

0 commit comments

Comments
 (0)