Changeset 8645
- Timestamp:
- 04/27/08 17:37:17 (3 months ago)
- Files:
-
- branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/AttachmentForm.class.php (modified) (1 diff)
- branches/1.1/test/functional/fixtures/project/apps/i18n/modules/i18n/actions/actions.class.php (modified) (1 diff)
- branches/1.1/test/unit/plugin/sfPluginManagerTest.php (modified) (1 diff)
- branches/1.1/test/unit/plugin/sfPluginTestHelper.class.php (modified) (1 diff)
- branches/1.1/test/unit/util/sfFinderTest.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/plugins/sfPropelPlugin/test/functional/fixtures/lib/form/AttachmentForm.class.php
r8535 r8645 13 13 { 14 14 $this->widgetSchema['file'] = new sfWidgetFormInputFile(); 15 $this->validatorSchema['file'] = new sfValidatorFile(); 15 16 $fileValidator = new sfValidatorFile(); 17 $fileValidator->setOption('mime_type_guessers', array()); 18 $this->validatorSchema['file'] = $fileValidator; 16 19 } 17 20 } branches/1.1/test/functional/fixtures/project/apps/i18n/modules/i18n/actions/actions.class.php
r8610 r8645 43 43 { 44 44 $this->form = new I18nCustomCatalogueForm(); 45 $this->setTemplate(' I18nForm');45 $this->setTemplate('i18nForm'); 46 46 } 47 47 } branches/1.1/test/unit/plugin/sfPluginManagerTest.php
r6218 r8645 183 183 $pluginManager->installPlugin('sfTestPlugin'); 184 184 $installed = $pluginManager->getInstalledPlugins(); 185 $t->is($installed[1]->getName(), 'sfTestPlugin', '->getInstalledPlugin() returns an array of installed packages'); 185 $a = array($installed[0]->getName(), $installed[1]->getName()); 186 $b = array('sfTestPlugin', 'sfMainPackage'); 187 sort($a); 188 sort($b); 189 $t->is($a, $b, '->getInstalledPlugin() returns an array of installed packages'); 186 190 $t->is(count($installed), 2, '->getInstalledPlugin() returns an array of installed packages'); 187 191 $pluginManager->uninstallPlugin('sfTestPlugin'); branches/1.1/test/unit/plugin/sfPluginTestHelper.class.php
r5250 r8645 5 5 static public function convertUrlToFixture($url) 6 6 { 7 $file = preg_replace(array('/_+/', '#/+#', '#_/#'), array('_', '/', '/'), preg_replace('#[^a-zA-Z0-9\-/\.]#', '_', strtolower($url)));7 $file = preg_replace(array('/_+/', '#/+#', '#_/#'), array('_', '/', '/'), preg_replace('#[^a-zA-Z0-9\-/\.]#', '_', $url)); 8 8 9 9 $dir = dirname($file); branches/1.1/test/unit/util/sfFinderTest.php
r8390 r8645 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(37, new lime_output_color()); 13 class my_lime_test extends lime_test 14 { 15 public function arrays_are_equal($a, $b, $message) 16 { 17 sort($a); 18 sort($b); 19 20 return $this->is($a, $b, $message); 21 } 22 } 23 $t = new my_lime_test(37, new lime_output_color()); 14 24 15 25 require_once($_test_dir.'/../lib/util/sfFinder.class.php'); … … 101 111 $t->diag('->name() file name support'); 102 112 $finder = sfFinder::type('file')->name('file21.php')->relative(); 103 $t-> is($finder->in($fixtureDir), array('dir1/dir2/file21.php'), '->name() can take a file name as an argument');113 $t->arrays_are_equal($finder->in($fixtureDir), array('dir1/dir2/file21.php'), '->name() can take a file name as an argument'); 104 114 105 115 $t->diag('->name() globs support'); 106 116 $finder = sfFinder::type('file')->name('*.php')->relative(); 107 $t-> is($finder->in($fixtureDir), $phpFiles, '->name() can take a glob pattern as an argument');117 $t->arrays_are_equal($finder->in($fixtureDir), $phpFiles, '->name() can take a glob pattern as an argument'); 108 118 109 119 $t->diag('->name() regexp support'); 110 120 $finder = sfFinder::type('file')->name('/^file2.*$/')->relative(); 111 $t-> is($finder->in($fixtureDir), $regexpFiles, '->name() can take a regexp as an argument');121 $t->arrays_are_equal($finder->in($fixtureDir), $regexpFiles, '->name() can take a regexp as an argument'); 112 122 113 123 $t->diag('->name() array / args / chaining'); 114 124 $finder = sfFinder::type('file')->name(array('*.php', '*.txt'))->relative(); 115 $t-> is($finder->in($fixtureDir), array_merge($phpFiles, $txtFiles), '->name() can take an array of patterns');125 $t->arrays_are_equal($finder->in($fixtureDir), array_merge($phpFiles, $txtFiles), '->name() can take an array of patterns'); 116 126 $finder = sfFinder::type('file')->name('*.php', '*.txt')->relative(); 117 $t-> is($finder->in($fixtureDir), array_merge($phpFiles, $txtFiles), '->name() can take patterns as arguments');127 $t->arrays_are_equal($finder->in($fixtureDir), array_merge($phpFiles, $txtFiles), '->name() can take patterns as arguments'); 118 128 $finder = sfFinder::type('file')->name('*.php')->name('*.txt')->relative(); 119 $t-> is($finder->in($fixtureDir), array_merge($phpFiles, $txtFiles), '->name() can be called several times');129 $t->arrays_are_equal($finder->in($fixtureDir), array_merge($phpFiles, $txtFiles), '->name() can be called several times'); 120 130 121 131 // ->not_name() … … 126 136 $t->diag('->not_name() file name support'); 127 137 $finder = sfFinder::type('file')->not_name('file21.php')->relative(); 128 $t-> is($finder->in($fixtureDir), array_values(array_diff($allFiles, array('dir1/dir2/file21.php'))), '->not_name() can take a file name as an argument');138 $t->arrays_are_equal($finder->in($fixtureDir), array_values(array_diff($allFiles, array('dir1/dir2/file21.php'))), '->not_name() can take a file name as an argument'); 129 139 130 140 $t->diag('->not_name() globs support'); 131 141 $finder = sfFinder::type('file')->not_name('*.php')->relative(); 132 $t-> is($finder->in($fixtureDir), array_values(array_diff($allFiles, $phpFiles)), '->not_name() can take a glob pattern as an argument');142 $t->arrays_are_equal($finder->in($fixtureDir), array_values(array_diff($allFiles, $phpFiles)), '->not_name() can take a glob pattern as an argument'); 133 143 134 144 $t->diag('->not_name() regexp support'); 135 145 $finder = sfFinder::type('file')->not_name('/^file2.*$/')->relative(); 136 $t-> is($finder->in($fixtureDir), array_values(array_diff($allFiles, $regexpFiles)), '->not_name() can take a regexp as an argument');146 $t->arrays_are_equal($finder->in($fixtureDir), array_values(array_diff($allFiles, $regexpFiles)), '->not_name() can take a regexp as an argument'); 137 147 138 148 $t->diag('->not_name() array / args / chaining'); 139 149 $finder = sfFinder::type('file')->not_name(array('*.php', '*.txt'))->relative(); 140 $t-> is($finder->in($fixtureDir), array_values(array_diff($allFiles, array_merge($phpFiles, $txtFiles))), '->not_name() can take an array of patterns');150 $t->arrays_are_equal($finder->in($fixtureDir), array_values(array_diff($allFiles, array_merge($phpFiles, $txtFiles))), '->not_name() can take an array of patterns'); 141 151 $finder = sfFinder::type('file')->not_name('*.php', '*.txt')->relative(); 142 $t-> is($finder->in($fixtureDir), array_values(array_diff($allFiles, array_merge($phpFiles, $txtFiles))), '->not_name() can take patterns as arguments');152 $t->arrays_are_equal($finder->in($fixtureDir), array_values(array_diff($allFiles, array_merge($phpFiles, $txtFiles))), '->not_name() can take patterns as arguments'); 143 153 $finder = sfFinder::type('file')->not_name('*.php')->not_name('*.txt')->relative(); 144 $t-> is($finder->in($fixtureDir), array_values(array_diff($allFiles, array_merge($phpFiles, $txtFiles))), '->not_name() can be called several times');154 $t->arrays_are_equal($finder->in($fixtureDir), array_values(array_diff($allFiles, array_merge($phpFiles, $txtFiles))), '->not_name() can be called several times'); 145 155 146 156 $t->diag('->name() ->not_name() in the same query'); 147 157 $finder = sfFinder::type('file')->not_name('/^file2.*$/')->name('*.php')->relative(); 148 $t-> is($finder->in($fixtureDir), array('dir1/file12.php'), '->not_name() and ->name() can be called in the same query');158 $t->arrays_are_equal($finder->in($fixtureDir), array('dir1/file12.php'), '->not_name() and ->name() can be called in the same query'); 149 159 150 160 // ->size() … … 167 177 168 178 $finder = sfFinder::type('file')->relative()->mindepth(1); 169 $t-> is($finder->in($fixtureDir), $minDepth1Files, '->mindepth() takes a minimum depth as its argument');179 $t->arrays_are_equal($finder->in($fixtureDir), $minDepth1Files, '->mindepth() takes a minimum depth as its argument'); 170 180 $finder = sfFinder::type('file')->relative()->maxdepth(2); 171 $t-> is($finder->in($fixtureDir), $maxDepth2Files, '->maxdepth() takes a maximum depth as its argument');181 $t->arrays_are_equal($finder->in($fixtureDir), $maxDepth2Files, '->maxdepth() takes a maximum depth as its argument'); 172 182 $finder = sfFinder::type('file')->relative()->mindepth(1)->maxdepth(2); 173 $t-> is($finder->in($fixtureDir), array_values(array_intersect($minDepth1Files, $maxDepth2Files)), '->maxdepth() and ->mindepth() can be called in the same query');183 $t->arrays_are_equal($finder->in($fixtureDir), array_values(array_intersect($minDepth1Files, $maxDepth2Files)), '->maxdepth() and ->mindepth() can be called in the same query'); 174 184 175 185 // ->discard() … … 179 189 $t->diag('->discard() file name support'); 180 190 $finder = sfFinder::type('file')->relative()->discard('file2.txt'); 181 $t-> is($finder->in($fixtureDir), array_values(array_diff($allFiles, array('file2.txt'))), '->discard() can discard a file name');191 $t->arrays_are_equal($finder->in($fixtureDir), array_values(array_diff($allFiles, array('file2.txt'))), '->discard() can discard a file name'); 182 192 183 193 $t->diag('->discard() glob support'); 184 194 $finder = sfFinder::type('file')->relative()->discard('*.php'); 185 $t-> is($finder->in($fixtureDir), array_values(array_diff($allFiles, $phpFiles)), '->discard() can discard a glob pattern');195 $t->arrays_are_equal($finder->in($fixtureDir), array_values(array_diff($allFiles, $phpFiles)), '->discard() can discard a glob pattern'); 186 196 187 197 $t->diag('->discard() regexp support'); 188 198 $finder = sfFinder::type('file')->relative()->discard('/^file2.*$/'); 189 $t-> is($finder->in($fixtureDir), array_values(array_diff($allFiles, $regexpFiles)), '->discard() can discard a regexp pattern');199 $t->arrays_are_equal($finder->in($fixtureDir), array_values(array_diff($allFiles, $regexpFiles)), '->discard() can discard a regexp pattern'); 190 200 191 201 // ->prune() … … 194 204 195 205 $finder = sfFinder::type('any')->relative()->prune('dir2'); 196 $t-> is($finder->in($fixtureDir), $anyWithoutDir2, '->prune() ignore all files/directories under the given directory');206 $t->arrays_are_equal($finder->in($fixtureDir), $anyWithoutDir2, '->prune() ignore all files/directories under the given directory');