Projet

Général

Profil

Paste
Télécharger (2,55 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / libraries / simplepie / tests / oldtests.php @ 41cc1b08

1
<?php
2

    
3
date_default_timezone_set('UTC');
4
error_reporting(E_ALL | E_STRICT);
5

    
6
require_once dirname(__FILE__) . '/bootstrap.php';
7
require_once dirname(__FILE__) . '/oldtests/compat_test_harness.php';
8
require_once dirname(__FILE__) . '/oldtests/functions.php';
9

    
10
class OldTest extends PHPUnit_Framework_TestCase
11
{
12
    public function getTests()
13
    {
14
        $test_folders = array(
15
            'absolutize',
16
            'date',
17
            'feed_category_label',
18
            'feed_copyright',
19
            'feed_description',
20
            'feed_image_height',
21
            'feed_image_link',
22
            'feed_image_title',
23
            'feed_image_url',
24
            'feed_image_width',
25
            'feed_language',
26
            'feed_link',
27
            'feed_title',
28
            'first_item_author_name',
29
            'first_item_category_label',
30
            'first_item_content',
31
            'first_item_contributor_name',
32
            'first_item_date',
33
            'first_item_description',
34
            'first_item_id',
35
            'first_item_latitude',
36
            'first_item_longitude',
37
            'first_item_permalink',
38
            'first_item_title',
39
            'itunes_rss'
40
        );
41
        
42
        $master = new Unit_Test2_Group('SimplePie Test Suite');
43
        
44
        foreach ($test_folders as $test)
45
        {
46
            $test_group = new SimplePie_Unit_Test2_Group(ucwords(str_replace('_', ' ', $test)));
47
            $test_group->load_folder(dirname(__FILE__) . '/oldtests/' . $test);
48
            $master->add($test_group);
49
        }
50
        
51
        $test_group = new SimplePie_Unit_Test2_Group('Who knows a <title> from a hole in the ground?');
52
        $test_group->load_folder(dirname(__FILE__) . '/oldtests/who_knows_a_title_from_a_hole_in_the_ground');
53
        $master->add($test_group);
54
        
55
        $tests = array();
56
        $groups = array($master);
57
        while ($group = array_shift($groups))
58
        {
59
            foreach ($group->tests as $group_tests)
60
            {
61
                foreach ($group_tests as $test)
62
                {
63
                    if ($test instanceof Unit_Test2)
64
                    {
65
                        $tests[] = array($test);
66
                    }
67
                    elseif ($test instanceof Unit_Test2_Group)
68
                    {
69
                        $groups[] = $test;
70
                    }
71
                }
72
            }
73
        }
74
        return $tests;
75
    }
76
 
77
    /**
78
     * @dataProvider getTests
79
     */
80
    public function testOld($test)
81
    {
82
        $test->run();
83
        $this->assertSame($test->expected, $test->result);
84
    }
85
}