function testCheckDetail() { $exception = 0; $longName = ''; for ($i = 0; $i < 512; $i++) { $longName .= 'a'; } $info = new VoiceInfo(array('title' => $longName)); try { $info->checkDetail(); } catch (VoiceException $ex) { $exception++; } $info = new VoiceInfo(array('artist' => $longName)); try { $info->checkDetail(); } catch (VoiceException $ex) { $exception++; } $info = new VoiceInfo(array('description' => $longName)); try { $info->checkDetail(); } catch (VoiceException $ex) { $exception++; } $info = new VoiceInfo(array('tags' => $longName)); try { $info->checkDetail(); } catch (VoiceException $ex) { $exception++; } $this->assertSame(4, $exception); }
function handleEdit() { $voiceNew = new VoiceInfo($_REQUEST); $voiceNew->checkDetail(); $imageFile = $_FILES['image_file']; if ($imageFile['size'] > 0) { $imageInfo = $this->imageFile->save($this->userid, $imageFile); $voiceNew->imageid = $imageInfo->imageid; } $this->voiceDb->updateDetail($voiceNew); }