-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathInstallCommandTest.php
More file actions
73 lines (50 loc) · 2.23 KB
/
InstallCommandTest.php
File metadata and controls
73 lines (50 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
it("installs a component without dependencies", function () {
$this->artisan("sheaf:install separator")
->assertExitCode(0)
->run();
$this->view('components.ui.separator.index');
$this->artisan("sheaf:remove separator");
});
it("installs a component along with its dependencies when confirmed", function () {
$this->artisan("sheaf:install radio")
->expectsQuestion('Install required dependencies?', 'yes')
->assertExitCode(0)
->run();
$this->view("components.ui.radio.group", ['slot' => 'default']);
$this->artisan("sheaf:remove radio");
});
it("overwrites existing component files when forced", function () {
$this->artisan("sheaf:install separator")
->assertExitCode(0)
->run();
$this->artisan("sheaf:install separator")
->expectsQuestion("Component 'Separator' already exists. What would you like to do?", "overwrite")
->expectsQuestion("All the component files will be overwritten, you might lose your modifications. are you sure you want to proceed?", "yes")
->expectsOutputToContain("All component files will be overwritten.")
->assertExitCode(0)
->run();
$this->view("components.ui.separator.index");
$this->artisan("sheaf:remove separator");
});
it("installs only dependencies when the component already exists and that option is chosen", function () {
$command = 'sheaf:install separator';
$this->artisan($command)
->assertExitCode(0)
->run();
$this->artisan($command)
->expectsQuestion("Component 'Separator' already exists. What would you like to do?", "dependencies")
->expectsOutputToContain("Skipping component files, checking dependencies...")
->assertExitCode(0)
->run();
$this->view("components.ui.separator.index");
$this->artisan("sheaf:remove separator");
});
it("simulates component installation with the dry-run option", function () {
$this->artisan("sheaf:install alerts --dry-run")
->expectsOutputToContain("Preview: Installing Alerts (Dry Run)")
->expectsOutputToContain("Will create")
->assertExitCode(0)
->run();
expect(view()->exists("components.ui.alerts.index"))->toBeFalse();
});