public function testIndexPostWithDefaultKey() { Setting::write('App.FirstKey', 'First Value'); Setting::write('App.SecondKey', 'Second Value'); Setting::write('CA.ThirthKey', 'Thirth Value'); $this->session(['Auth' => ['CakeAdmin' => ['id' => 1, 'email' => '*****@*****.**', 'cakeadmin' => 1]]]); $settings = TableRegistry::get('Settings.Configurations'); $this->assertEquals('First Value', $settings->findByName('App.FirstKey')->toArray()[0]['value']); $this->post('/admin/settings', [['id' => '1', 'value' => 'First Value Edited']]); $this->assertResponseSuccess(); $this->assertEquals('First Value Edited', $settings->findByName('App.FirstKey')->toArray()[0]['value']); }
/** * Test autoload-method * * @return void */ public function testAutoload() { Setting::write('App.Test1', 'Test1'); Setting::write('App.Test2', 'Test2'); Setting::clear(); $this->assertEmpty(Setting::read()); Setting::clear(true); Setting::autoLoad(); $_array = ['App.Test1' => 'Test1', 'App.Test2' => 'Test2']; $this->assertEquals($_array, Setting::read()); }