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