|
6 | 6 |
|
7 | 7 | use CodeIgniter\Shield\Commands\Setup; |
8 | 8 | use CodeIgniter\Shield\Test\MockInputOutput; |
| 9 | +use Config\Email as EmailConfig; |
9 | 10 | use Config\Services; |
10 | 11 | use org\bovigo\vfs\vfsStream; |
11 | 12 | use Tests\Support\TestCase; |
@@ -92,4 +93,39 @@ public function testRun(): void |
92 | 93 | $result |
93 | 94 | ); |
94 | 95 | } |
| 96 | + |
| 97 | + public function testRunEmailConfigIsFine(): void |
| 98 | + { |
| 99 | + // Set MockIO and your inputs. |
| 100 | + $this->setMockIo(['y']); |
| 101 | + |
| 102 | + $config = config(EmailConfig::class); |
| 103 | + $config-> fromEmail = '[email protected]'; |
| 104 | + $config->fromName = 'Site Admin'; |
| 105 | + |
| 106 | + $root = vfsStream::setup('root'); |
| 107 | + vfsStream::copyFromFileSystem( |
| 108 | + APPPATH, |
| 109 | + $root |
| 110 | + ); |
| 111 | + $appFolder = $root->url() . '/'; |
| 112 | + |
| 113 | + $command = new Setup(Services::logger(), Services::commands()); |
| 114 | + |
| 115 | + $this->setPrivateProperty($command, 'distPath', $appFolder); |
| 116 | + |
| 117 | + $command->run([]); |
| 118 | + |
| 119 | + $result = str_replace(["\033[0;32m", "\033[0m"], '', $this->io->getOutputs()); |
| 120 | + |
| 121 | + $this->assertStringContainsString( |
| 122 | + ' Created: vfs://root/Config/Auth.php |
| 123 | + Created: vfs://root/Config/AuthGroups.php |
| 124 | + Created: vfs://root/Config/AuthToken.php |
| 125 | + Updated: vfs://root/Controllers/BaseController.php |
| 126 | + Updated: vfs://root/Config/Routes.php |
| 127 | + Updated: We have updated file \'vfs://root/Config/Security.php\' for security reasons.', |
| 128 | + $result |
| 129 | + ); |
| 130 | + } |
95 | 131 | } |
0 commit comments