Page MenuHomePhorge

D2110.1775152280.diff
No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None

D2110.1775152280.diff

diff --git a/src/app/Console/Commands/Scalpel/WalletSetting/CreateCommand.php b/src/app/Console/Commands/Scalpel/WalletSetting/CreateCommand.php
--- a/src/app/Console/Commands/Scalpel/WalletSetting/CreateCommand.php
+++ b/src/app/Console/Commands/Scalpel/WalletSetting/CreateCommand.php
@@ -6,7 +6,7 @@
class CreateCommand extends ObjectCreateCommand
{
- protected $cacheKeys = ['wallet_settings_%wallet_id%'];
+ protected $cacheKeys = ['app\wallet_settings_%wallet_id%'];
protected $commandPrefix = 'scalpel';
protected $objectClass = \App\WalletSetting::class;
protected $objectName = 'wallet-setting';
diff --git a/src/app/Console/Commands/Scalpel/WalletSetting/UpdateCommand.php b/src/app/Console/Commands/Scalpel/WalletSetting/UpdateCommand.php
--- a/src/app/Console/Commands/Scalpel/WalletSetting/UpdateCommand.php
+++ b/src/app/Console/Commands/Scalpel/WalletSetting/UpdateCommand.php
@@ -6,7 +6,7 @@
class UpdateCommand extends ObjectUpdateCommand
{
- protected $cacheKeys = ['wallet_settings_%wallet_id%'];
+ protected $cacheKeys = ['app\wallet_settings_%wallet_id%'];
protected $commandPrefix = 'scalpel';
protected $objectClass = \App\WalletSetting::class;
protected $objectName = 'wallet-setting';
diff --git a/src/tests/Feature/Console/Scalpel/WalletSetting/CreateCommandTest.php b/src/tests/Feature/Console/Scalpel/WalletSetting/CreateCommandTest.php
new file mode 100644
--- /dev/null
+++ b/src/tests/Feature/Console/Scalpel/WalletSetting/CreateCommandTest.php
@@ -0,0 +1,23 @@
+<?php
+
+namespace Tests\Feature\Console\Scalpel\WalletSetting;
+
+use Tests\TestCase;
+
+class CreateCommandTest extends TestCase
+{
+ public function testHandle(): void
+ {
+ $user = $this->getTestUser('john@kolab.org');
+ $wallet = $user->wallets->first();
+ $wallet->setSetting('test', null);
+
+ $this->artisan("scalpel:wallet-setting:create --key=test --value=init --wallet_id={$wallet->id}")
+ ->assertExitCode(0);
+
+ $setting = $wallet->settings()->where('key', 'test')->first();
+
+ $this->assertSame('init', $setting->fresh()->value);
+ $this->assertSame('init', $wallet->fresh()->getSetting('test'));
+ }
+}
diff --git a/src/tests/Feature/Console/Scalpel/WalletSetting/UpdateCommandTest.php b/src/tests/Feature/Console/Scalpel/WalletSetting/UpdateCommandTest.php
new file mode 100644
--- /dev/null
+++ b/src/tests/Feature/Console/Scalpel/WalletSetting/UpdateCommandTest.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Tests\Feature\Console\Scalpel\WalletSetting;
+
+use Tests\TestCase;
+
+class UpdateCommandTest extends TestCase
+{
+ public function testHandle(): void
+ {
+ $user = $this->getTestUser('john@kolab.org');
+ $wallet = $user->wallets->first();
+ $wallet->setSetting('test', 'init');
+
+ $this->artisan("scalpel:wallet-setting:update unknown --value=test")
+ ->assertExitCode(1)
+ ->expectsOutput("No such wallet-setting unknown");
+
+ $setting = $wallet->settings()->where('key', 'test')->first();
+
+ $this->artisan("scalpel:wallet-setting:update {$setting->id} --value=test")
+ ->assertExitCode(0);
+
+ $this->assertSame('test', $setting->fresh()->value);
+ $this->assertSame('test', $wallet->fresh()->getSetting('test'));
+ }
+}

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 2, 5:51 PM (12 m, 45 s ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18820126
Default Alt Text
D2110.1775152280.diff (3 KB)

Event Timeline