add length limit contents
This commit is contained in:
parent
dc278db845
commit
a2502bc1c6
|
@ -8,7 +8,8 @@ class Content extends AbstractRule {
|
|||
public function validate($content) {
|
||||
$content = str_replace(" ",'',preg_replace("/<\s*[^>]*>/",'',$content));
|
||||
|
||||
if($content != '')return true;
|
||||
return false;
|
||||
if($content == '') return false;
|
||||
if(strlen($content) > 1250) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ describe'system/disable-user-system' do
|
|||
|
||||
numberOftickets = $database.query("SELECT * FROM ticket WHERE author_id IS NULL AND author_email IS NOT NULL AND author_name IS NOT NULL")
|
||||
|
||||
(numberOftickets.num_rows).should.equal(54)
|
||||
(numberOftickets.num_rows).should.equal(53)
|
||||
|
||||
request('/user/logout')
|
||||
|
||||
|
@ -220,7 +220,7 @@ describe'system/disable-user-system' do
|
|||
|
||||
numberOftickets= $database.query("SELECT * FROM ticket WHERE author_email IS NULL AND author_name IS NULL AND author_id IS NOT NULL" )
|
||||
|
||||
(numberOftickets.num_rows).should.equal(57)
|
||||
(numberOftickets.num_rows).should.equal(56)
|
||||
end
|
||||
|
||||
it 'should not enable the user system' do
|
||||
|
|
|
@ -45,7 +45,7 @@ describe '/ticket/create' do
|
|||
(result['status']).should.equal('success')
|
||||
end
|
||||
|
||||
it 'should create ticket with a large content' do
|
||||
it 'should fail if the ticket has a very large content' do
|
||||
long_text = ''
|
||||
6000.times {long_text << 'a'}
|
||||
|
||||
|
@ -58,7 +58,8 @@ describe '/ticket/create' do
|
|||
csrf_token: $csrf_token
|
||||
})
|
||||
|
||||
(result['status']).should.equal('success')
|
||||
(result['status']).should.equal('fail')
|
||||
(result['message']).should.equal('INVALID_CONTENT')
|
||||
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue