Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
/*
4
 * This file is part of the symfony package.
5
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
 
11
$app = 'frontend';
12
require_once dirname(__FILE__).'/../bootstrap/functional.php';
13
 
14
$browser = new sfTestFunctional(new sfBrowser(), null, array(
15
  'doctrine' => 'sfTesterDoctrine',
16
));
17
 
18
$browser
19
  ->get('/attachment/index')
20
 
21
  ->setField('attachment[file_path]', sfConfig::get('sf_config_dir').'/databases.yml')
22
  ->click('submit')
23
 
24
  ->with('response')->begin()
25
    ->checkElement('h1:contains("ok")')
26
  ->end()
27
 
28
  ->with('doctrine')->check('Attachment', array(
29
    'file_path' => AttachmentForm::TEST_GENERATED_FILENAME,
30
  ), 1)
31
;
32
 
33
$browser->test()->is(file_exists(sfConfig::get('sf_cache_dir').'/'.AttachmentForm::TEST_GENERATED_FILENAME), true, 'uploaded file is named correctly');
34
 
35
$browser
36
  ->get('/attachment/editable?id=1')
37
 
38
  ->setField('attachment[file_path_delete]', 1)
39
  ->click('submit')
40
 
41
  ->with('response')->begin()
42
    ->checkElement('h1', 'ok')
43
  ->end()
44
 
45
  ->with('doctrine')->check('Attachment', array(
46
    'file_path' => AttachmentForm::TEST_GENERATED_FILENAME,
47
  ), false)
48
;
49
 
50
$browser->test()->is(file_exists(sfConfig::get('sf_cache_dir').'/'.AttachmentForm::TEST_GENERATED_FILENAME), false, 'uploaded file is removed');