/** * Removes files if allowFiles is set to 0 * @return void */ public function checkForFiles() { if (!$this->modx->getOption('allowFiles', $this->config, true)) { $fields = $this->dictionary->toArray(); foreach ($fields as $key => $value) { if (is_array($value) && !empty($value['tmp_name'])) { $this->dictionary->remove($key); } } } }
/** * @param string $key * @dataProvider providerRemove */ public function testRemove($key) { $this->dictionary->fields[$key] = 'Test'; $this->dictionary->remove($key); $this->assertArrayNotHasKey($key, $this->dictionary->fields); }