Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 275a9f5

Browse filesBrowse files
committed
✅ Test Firstdeploy shared
1 parent 3ded5ec commit 275a9f5
Copy full SHA for 275a9f5

File tree

Expand file treeCollapse file tree

1 file changed

+53
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+53
-0
lines changed

‎tests/Recipes/FirstDeployTest.php

Copy file name to clipboard
+53Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
namespace Lorisleiva\LaravelDeployer\Test\Recipes;
4+
5+
use Lorisleiva\LaravelDeployer\Test\DeploymentTestCase;
6+
7+
class FirstDeployTest extends DeploymentTestCase
8+
{
9+
protected $recipe = 'basic';
10+
11+
/** @test */
12+
function firstdeploy_shared_copies_items_from_rootpath_if_exists()
13+
{
14+
// Given we have a text file in the storage of our rootpath.
15+
$this->runInRoot('mkdir -p storage/app/public');
16+
$this->runInRoot('touch storage/app/public/foobar.txt');
17+
18+
// And we have a .env file in out rootpath but ignored in our repository.
19+
$this->runInRoot('touch .env');
20+
$this->runInRoot('printf "APP_NAME=FooBar" > .env');
21+
22+
// When we deploy.
23+
$this->artisan('deploy');
24+
25+
// Then the text file has been added to our shared folder.
26+
$this->assertFileExists(self::TMP . '/shared/storage/app/public/foobar.txt');
27+
28+
// And the .env file comes from our rootpath.
29+
$this->assertStringEqualsFile(self::TMP . '/.env', 'APP_NAME=FooBar');
30+
}
31+
32+
/** @test */
33+
function in_case_of_conflict_it_takes_items_from_the_release_path()
34+
{
35+
// Given we have a `magic.gif` file on the rootpath
36+
$this->runInRoot('mkdir -p storage/app/public');
37+
$this->runInRoot('touch storage/app/public/magic.gif');
38+
$this->assertFileExists(self::TMP . '/storage/app/public/magic.gif');
39+
40+
// And a `magic.gif` file on the repository itself.
41+
$this->assertFileExists(self::REPOSITORY . '/storage/app/public/magic.gif');
42+
43+
// When we deploy.
44+
$this->artisan('deploy');
45+
46+
// Then the `magic.gif` file in the shared folder comes from the repository.
47+
$this->assertFileExists(self::TMP . '/shared/storage/app/public/magic.gif');
48+
$this->assertFileEquals(
49+
self::REPOSITORY . '/storage/app/public/magic.gif',
50+
self::TMP . '/shared/storage/app/public/magic.gif'
51+
);
52+
}
53+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.