Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F9582424
D241.id744.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D241.id744.diff
View Options
diff --git a/tests/Console/Commands/ConfigShowTest.php b/tests/Console/Commands/ConfigShowTest.php
new file mode 100644
--- /dev/null
+++ b/tests/Console/Commands/ConfigShowTest.php
@@ -0,0 +1,74 @@
+<?php
+
+namespace Nasqueron\Notifications\Tests\Console\Commands;
+
+use Nasqueron\Notifications\Features;
+use Nasqueron\Notifications\Services\Service;
+
+use Mockery;
+
+class ConfigShowTest extends TestCase {
+
+ /**
+ * @var string
+ */
+ protected $class = 'Nasqueron\Notifications\Console\Commands\ConfigShow';
+
+ /**
+ * Nasqueron\Notifications\Services\Services
+ */
+ private $servicesMock;
+
+ public function setUp () {
+ parent::setUp();
+
+ $this->mockServices();
+ }
+
+ protected function mockServices () {
+ // Inject into our container a mock of Services
+ $this->servicesMock = Mockery::mock('Nasqueron\Notifications\Services\Services');
+ $this->app->instance('services', $this->servicesMock);
+ }
+
+ protected function mockService () {
+ $service = new Service;
+ $service->gate = 'Storm';
+ $service->door = 'Acme';
+ $service->instance = "http://www.perdu.com";
+ return $service;
+ }
+
+ public function testRegularExecute () {
+ //Our command calls Services::get()
+ $this->servicesMock->shouldReceive('get')->once()->andReturn([]);
+
+ $this->tester->execute(['command' => $this->command->getName()]);
+
+ $this->assertRegexp('/Gates/', $this->tester->getDisplay());
+ $this->assertRegexp('/Features/', $this->tester->getDisplay());
+ $this->assertRegexp('/Services declared/', $this->tester->getDisplay());
+ }
+
+ public function testRegularExecuteWithService () {
+ $service = $this->mockService();
+ $this->servicesMock
+ ->shouldReceive('get')
+ ->once()
+ ->andReturn([$service]);
+
+ $this->tester->execute(['command' => $this->command->getName()]);
+ $this->assertRegexp('/Storm/', $this->tester->getDisplay());
+ }
+
+ public function testExecuteWhenSomeFeatureIsDisabled () {
+ Features::disable('ActionsReport');
+
+ $this->servicesMock->shouldReceive('get')->once()->andReturn([]);
+
+ $this->tester->execute(['command' => $this->command->getName()]);
+ $this->assertRegexp('/Gate *\| *✓ *\|/', $this->tester->getDisplay());
+ $this->assertRegexp('/ActionsReport *\| *\|/', $this->tester->getDisplay());
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jun 9, 19:37 (13 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2717376
Default Alt Text
D241.id744.diff (2 KB)
Attached To
Mode
D241: Tests for config:show console command
Attached
Detach File
Event Timeline
Log In to Comment