Completed
Pull Request — master (#224)
by Juliette
02:57
created

BaseClass_FunctionsTest::dataStripQuotes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
/**
3
 * Generic sniff functions test file
4
 *
5
 * @package PHPCompatibility
6
 */
7
8
9
/**
10
 * Generic sniff functions sniff tests
11
 *
12
 * @uses    PHPUnit_Framework_TestCase
13
 * @package PHPCompatibility
14
 * @author  Juliette Reinders Folmer <[email protected]>
15
 */
16
class BaseClass_FunctionsTest extends PHPUnit_Framework_TestCase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
17
{
18
19
    /**
20
     * A wrapper for the abstract PHPCompatibility sniff.
21
     *
22
     * @var PHPCompatibility_Sniff
23
     */
24
    protected $helperClass;
25
26
27
    public static function setUpBeforeClass()
28
    {
29
        require_once dirname(__FILE__) . '/TestHelperPHPCompatibility.php';
30
    }
31
32
    protected function setUp()
33
    {
34
        parent::setUp();
35
36
        $this->helperClass = new BaseClass_TestHelperPHPCompatibility;
37
    }
38
39
40
   /**
41
     * testStripQuotes
42
     *
43
     * @group utilityFunctions
44
     *
45
     * @dataProvider dataStripQuotes
46
     *
47
     * @param string $input    The input string.
48
     * @param string $expected The expected function output.
49
     */
50
    public function testStripQuotes($input, $expected)
51
    {
52
        $this->assertSame($expected, $this->helperClass->stripQuotes($input));
53
    }
54
55
    /**
56
     * dataStripQuotes
57
     *
58
     * @see testStripQuotes()
59
     *
60
     * @return array
61
     */
62
    public function dataStripQuotes()
63
    {
64
        return array(
65
            array('"dir_name"', 'dir_name'),
66
            array("'soap.wsdl_cache'", 'soap.wsdl_cache'),
67
            array('"arbitrary-\'string\" with\' quotes within"', 'arbitrary-\'string\" with\' quotes within'),
68
            array('"\'quoted_name\'"', "'quoted_name'"),
69
            array("'\"quoted\" start of string'", '"quoted" start of string'),
70
        );
71
    }
72
73
}
74