Development

Changeset 33292

You must first sign up to be able to contribute.

Changeset 33292

Show
Ignore:
Timestamp:
12/22/11 22:46:41 (5 months ago)
Author:
fabien
Message:

[1.4] fixed test for PHP 5.3 (patch from pylebecq)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.4/test/unit/validator/sfValidatorFileTest.php

    r19531 r33292  
    7676{ 
    7777  $v = new testValidatorFile(); 
    78   $t->is($v->guessFromFileinfo($tmpDir.'/test.txt'), (version_compare(PHP_VERSION, '5.3', '<')) ? 'text/plain' : 'text/plain; charset=us-ascii', '->guessFromFileinfo() guesses the type of a given file'); 
     78  $t->is($v->guessFromFileinfo($tmpDir.'/test.txt'), 'text/plain', '->guessFromFileinfo() guesses the type of a given file'); 
    7979  $t->is($v->guessFromFileinfo($tmpDir.'/foo.txt'), null, '->guessFromFileinfo() returns null if the file type is not guessable'); 
    8080} 
     
    8989{ 
    9090  $v = new testValidatorFile(); 
    91   $t->is($v->guessFromMimeContentType($tmpDir.'/test.txt'), (version_compare(PHP_VERSION, '5.3', '<')) ? 'text/plain' : 'text/plain; charset=us-ascii', '->guessFromMimeContentType() guesses the type of a given file'); 
     91  $t->is($v->guessFromMimeContentType($tmpDir.'/test.txt'), 'text/plain', '->guessFromMimeContentType() guesses the type of a given file'); 
    9292  $t->is($v->guessFromMimeContentType($tmpDir.'/foo.txt'), null, '->guessFromMimeContentType() returns null if the file type is not guessable'); 
    9393} 
     
    103103$t->diag('->getMimeType()'); 
    104104$v = new testValidatorFile(); 
    105 $t->is($v->getMimeType($tmpDir.'/test.txt', 'image/png'), (version_compare(PHP_VERSION, '5.3', '<')) ? 'text/plain' : 'text/plain; charset=us-ascii', '->getMimeType() guesses the type of a given file'); 
     105$t->is($v->getMimeType($tmpDir.'/test.txt', 'image/png'), 'text/plain', '->getMimeType() guesses the type of a given file'); 
    106106$t->is($v->getMimeType($tmpDir.'/foo.txt', 'text/plain'), 'text/plain', '->getMimeType() returns the default type if the file type is not guessable'); 
    107107 
     
    127127$t->is($f->getOriginalName(), '', '->clean() returns a sfValidatedFile with an empty original name if the name is not passed in the initial value'); 
    128128$t->is($f->getSize(), strlen($content), '->clean() returns a sfValidatedFile with a computed file size if the size is not passed in the initial value'); 
    129 $t->is($f->getType(), (version_compare(PHP_VERSION, '5.3', '<')) ? 'text/plain' : 'text/plain; charset=us-ascii', '->clean() returns a sfValidatedFile with a guessed content type'); 
     129$t->is($f->getType(), 'text/plain', '->clean() returns a sfValidatedFile with a guessed content type'); 
    130130 
    131131class myValidatedFile extends sfValidatedFile