Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Console/Sku/ListUsersTest.php
Show All 28 Lines | class ListUsersTest extends TestCase | ||||
/** | /** | ||||
* Test command runs | * Test command runs | ||||
*/ | */ | ||||
public function testHandle(): void | public function testHandle(): void | ||||
{ | { | ||||
// Warning: We're not using artisan() here, as this will not | // Warning: We're not using artisan() here, as this will not | ||||
// allow us to test "empty output" cases | // allow us to test "empty output" cases | ||||
$code = \Artisan::call('sku:list-users meet'); | $code = \Artisan::call('sku:list-users domain-registration'); | ||||
$output = trim(\Artisan::output()); | $output = trim(\Artisan::output()); | ||||
$this->assertSame(0, $code); | $this->assertSame(0, $code); | ||||
$this->assertSame('', $output); | $this->assertSame('', $output); | ||||
$code = \Artisan::call('sku:list-users unknown'); | $code = \Artisan::call('sku:list-users unknown'); | ||||
$output = trim(\Artisan::output()); | $output = trim(\Artisan::output()); | ||||
$this->assertSame(1, $code); | $this->assertSame(1, $code); | ||||
$this->assertSame("Unable to find the SKU.", $output); | $this->assertSame("Unable to find the SKU.", $output); | ||||
Show All 17 Lines | public function testHandle(): void | ||||
]; | ]; | ||||
$this->assertSame(implode("\n", $expected), $output); | $this->assertSame(implode("\n", $expected), $output); | ||||
$code = \Artisan::call('sku:list-users domain-hosting'); | $code = \Artisan::call('sku:list-users domain-hosting'); | ||||
$output = trim(\Artisan::output()); | $output = trim(\Artisan::output()); | ||||
$this->assertSame(0, $code); | $this->assertSame(0, $code); | ||||
$this->assertSame("john@kolab.org", $output); | $this->assertSame("john@kolab.org", $output); | ||||
$sku = \App\Sku::where('title', 'meet')->first(); | |||||
$user = $this->getTestUser('sku-list-users@kolabnow.com'); | |||||
$user->assignSku($sku); | |||||
$code = \Artisan::call('sku:list-users meet'); | |||||
$output = trim(\Artisan::output()); | |||||
$this->assertSame(0, $code); | |||||
$this->assertSame($user->email, $output); | |||||
$user->assignSku($sku); | |||||
$code = \Artisan::call('sku:list-users meet'); | |||||
$output = trim(\Artisan::output()); | |||||
$this->assertSame(0, $code); | |||||
$this->assertSame($user->email, $output); | |||||
} | } | ||||
} | } |