Completed
Pull Request — develop (#186)
by
unknown
21:16
created
tests/PhpSpreadsheetTests/WorksheetTest.php 1 patch
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -8,111 +8,111 @@
 block discarded – undo
8 8
 
9 9
 class WorksheetTest extends PHPUnit_Framework_TestCase
10 10
 {
11
-	public function testSetTitle()
12
-	{
13
-		$test_title = str_repeat('a', 31);
14
-
15
-		$worksheet = new Worksheet();
16
-		$worksheet->setTitle($test_title);
17
-		$this->assertSame($test_title, $worksheet->getTitle());
18
-	}
19
-
20
-	public function setTitleInvalidProvider()
21
-	{
22
-		return [
23
-			[str_repeat('a', 32), 'Maximum 31 characters allowed in sheet title.'],
24
-			['invalid*title', 'Invalid character found in sheet title'],
25
-		];
26
-	}
27
-
28
-	/** @dataProvider setTitleInvalidProvider */
29
-	public function testSetTitleInvalid($title, $expect_message)
30
-	{
31
-		// First, test setting title with validation disabled -- should be successful
32
-		$worksheet = new Worksheet();
33
-		$worksheet->setTitle($title, true, false);
34
-
35
-		// Next, test again with validation enabled -- this time we should fail
36
-		$worksheet = new Worksheet();
37
-		$this->expectException(\Exception::class);
38
-		$this->expectExceptionMessage($expect_message);
39
-		$worksheet->setTitle($title);
40
-	}
41
-
42
-	public function testSetTitleDuplicate()
43
-	{
44
-		// Create a Spreadsheet with three Worksheets (the first is created automatically)
45
-		$spreadsheet = new Spreadsheet();
46
-		$spreadsheet->createSheet();
47
-		$spreadsheet->createSheet();
48
-
49
-		// Set unique title -- should be unchanged
50
-		$sheet = $spreadsheet->getSheet(0);
51
-		$sheet->setTitle('Test Title');
52
-		$this->assertSame('Test Title', $sheet->getTitle());
53
-
54
-		// Set duplicate title -- should have numeric suffix appended
55
-		$sheet = $spreadsheet->getSheet(1);
56
-		$sheet->setTitle('Test Title');
57
-		$this->assertSame('Test Title 1', $sheet->getTitle());
58
-
59
-		// Set duplicate title with validation disabled -- should be unchanged
60
-		$sheet = $spreadsheet->getSheet(2);
61
-		$sheet->setTitle('Test Title', true, false);
62
-		$this->assertSame('Test Title', $sheet->getTitle());
63
-	}
64
-
65
-	public function testSetCodeName()
66
-	{
67
-		$test_code_name = str_repeat('a', 31);
68
-
69
-		$worksheet = new Worksheet();
70
-		$worksheet->setCodeName($test_code_name);
71
-		$this->assertSame($test_code_name, $worksheet->getCodeName());
72
-	}
73
-
74
-	public function setCodeNameInvalidProvider()
75
-	{
76
-		return [
77
-			[str_repeat('a', 32), 'Maximum 31 characters allowed in sheet code name.'],
78
-			['invalid*code*name', 'Invalid character found in sheet code name'],
79
-		];
80
-	}
81
-
82
-	/** @dataProvider setCodeNameInvalidProvider */
83
-	public function testSetCodeNameInvalid($code_name, $expect_message)
84
-	{
85
-		// First, test setting code name with validation disabled -- should be successful
86
-		$worksheet = new Worksheet();
87
-		$worksheet->setCodeName($code_name, false);
88
-
89
-		// Next, test again with validation enabled -- this time we should fail
90
-		$worksheet = new Worksheet();
91
-		$this->expectException(\Exception::class);
92
-		$this->expectExceptionMessage($expect_message);
93
-		$worksheet->setCodeName($code_name);
94
-	}
95
-
96
-	public function testSetCodeNameDuplicate()
97
-	{
98
-		// Create a Spreadsheet with three Worksheets (the first is created automatically)
99
-		$spreadsheet = new Spreadsheet();
100
-		$spreadsheet->createSheet();
101
-		$spreadsheet->createSheet();
102
-
103
-		// Set unique code name -- should be massaged to Snake_Case
104
-		$sheet = $spreadsheet->getSheet(0);
105
-		$sheet->setCodeName('Test Code Name');
106
-		$this->assertSame('Test_Code_Name', $sheet->getCodeName());
107
-
108
-		// Set duplicate code name -- should be massaged and have numeric suffix appended
109
-		$sheet = $spreadsheet->getSheet(1);
110
-		$sheet->setCodeName('Test Code Name');
111
-		$this->assertSame('Test_Code_Name_1', $sheet->getCodeName());
112
-
113
-		// Set duplicate code name with validation disabled -- should be unchanged, and unmassaged
114
-		$sheet = $spreadsheet->getSheet(2);
115
-		$sheet->setCodeName('Test Code Name', false);
116
-		$this->assertSame('Test Code Name', $sheet->getCodeName());
117
-	}
11
+    public function testSetTitle()
12
+    {
13
+        $test_title = str_repeat('a', 31);
14
+
15
+        $worksheet = new Worksheet();
16
+        $worksheet->setTitle($test_title);
17
+        $this->assertSame($test_title, $worksheet->getTitle());
18
+    }
19
+
20
+    public function setTitleInvalidProvider()
21
+    {
22
+        return [
23
+            [str_repeat('a', 32), 'Maximum 31 characters allowed in sheet title.'],
24
+            ['invalid*title', 'Invalid character found in sheet title'],
25
+        ];
26
+    }
27
+
28
+    /** @dataProvider setTitleInvalidProvider */
29
+    public function testSetTitleInvalid($title, $expect_message)
30
+    {
31
+        // First, test setting title with validation disabled -- should be successful
32
+        $worksheet = new Worksheet();
33
+        $worksheet->setTitle($title, true, false);
34
+
35
+        // Next, test again with validation enabled -- this time we should fail
36
+        $worksheet = new Worksheet();
37
+        $this->expectException(\Exception::class);
38
+        $this->expectExceptionMessage($expect_message);
39
+        $worksheet->setTitle($title);
40
+    }
41
+
42
+    public function testSetTitleDuplicate()
43
+    {
44
+        // Create a Spreadsheet with three Worksheets (the first is created automatically)
45
+        $spreadsheet = new Spreadsheet();
46
+        $spreadsheet->createSheet();
47
+        $spreadsheet->createSheet();
48
+
49
+        // Set unique title -- should be unchanged
50
+        $sheet = $spreadsheet->getSheet(0);
51
+        $sheet->setTitle('Test Title');
52
+        $this->assertSame('Test Title', $sheet->getTitle());
53
+
54
+        // Set duplicate title -- should have numeric suffix appended
55
+        $sheet = $spreadsheet->getSheet(1);
56
+        $sheet->setTitle('Test Title');
57
+        $this->assertSame('Test Title 1', $sheet->getTitle());
58
+
59
+        // Set duplicate title with validation disabled -- should be unchanged
60
+        $sheet = $spreadsheet->getSheet(2);
61
+        $sheet->setTitle('Test Title', true, false);
62
+        $this->assertSame('Test Title', $sheet->getTitle());
63
+    }
64
+
65
+    public function testSetCodeName()
66
+    {
67
+        $test_code_name = str_repeat('a', 31);
68
+
69
+        $worksheet = new Worksheet();
70
+        $worksheet->setCodeName($test_code_name);
71
+        $this->assertSame($test_code_name, $worksheet->getCodeName());
72
+    }
73
+
74
+    public function setCodeNameInvalidProvider()
75
+    {
76
+        return [
77
+            [str_repeat('a', 32), 'Maximum 31 characters allowed in sheet code name.'],
78
+            ['invalid*code*name', 'Invalid character found in sheet code name'],
79
+        ];
80
+    }
81
+
82
+    /** @dataProvider setCodeNameInvalidProvider */
83
+    public function testSetCodeNameInvalid($code_name, $expect_message)
84
+    {
85
+        // First, test setting code name with validation disabled -- should be successful
86
+        $worksheet = new Worksheet();
87
+        $worksheet->setCodeName($code_name, false);
88
+
89
+        // Next, test again with validation enabled -- this time we should fail
90
+        $worksheet = new Worksheet();
91
+        $this->expectException(\Exception::class);
92
+        $this->expectExceptionMessage($expect_message);
93
+        $worksheet->setCodeName($code_name);
94
+    }
95
+
96
+    public function testSetCodeNameDuplicate()
97
+    {
98
+        // Create a Spreadsheet with three Worksheets (the first is created automatically)
99
+        $spreadsheet = new Spreadsheet();
100
+        $spreadsheet->createSheet();
101
+        $spreadsheet->createSheet();
102
+
103
+        // Set unique code name -- should be massaged to Snake_Case
104
+        $sheet = $spreadsheet->getSheet(0);
105
+        $sheet->setCodeName('Test Code Name');
106
+        $this->assertSame('Test_Code_Name', $sheet->getCodeName());
107
+
108
+        // Set duplicate code name -- should be massaged and have numeric suffix appended
109
+        $sheet = $spreadsheet->getSheet(1);
110
+        $sheet->setCodeName('Test Code Name');
111
+        $this->assertSame('Test_Code_Name_1', $sheet->getCodeName());
112
+
113
+        // Set duplicate code name with validation disabled -- should be unchanged, and unmassaged
114
+        $sheet = $spreadsheet->getSheet(2);
115
+        $sheet->setCodeName('Test Code Name', false);
116
+        $this->assertSame('Test Code Name', $sheet->getCodeName());
117
+    }
118 118
 }
Please login to merge, or discard this patch.