Skip to content

Commit 41fb8c8

Browse files
committed
test: add test for EmailConfig is fine
1 parent b788545 commit 41fb8c8

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

tests/Commands/SetupTest.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use CodeIgniter\Shield\Commands\Setup;
88
use CodeIgniter\Shield\Test\MockInputOutput;
9+
use Config\Email as EmailConfig;
910
use Config\Services;
1011
use org\bovigo\vfs\vfsStream;
1112
use Tests\Support\TestCase;
@@ -92,4 +93,39 @@ public function testRun(): void
9293
$result
9394
);
9495
}
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+
}
95131
}

0 commit comments

Comments
 (0)