WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 87d2416

Browse files
committed
cs
1 parent 25da8b1 commit 87d2416

File tree

1 file changed

+10
-25
lines changed

1 file changed

+10
-25
lines changed

test/Test/Spreadsheet/Excel/Writer/ParserTest.php

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,19 @@ public function testConvertFunctionReturnsValue()
1515
{
1616
$parser = new Spreadsheet_Excel_Writer_Parser(0, 0x0500);
1717

18-
// Access protected method via reflection
1918
$method = new \ReflectionMethod($parser, '_convertFunction');
2019
$method->setAccessible(true);
2120

22-
// Test with a function that has fixed args (should return early)
23-
// TIME has 3 fixed arguments
21+
// Fixed args (TIME=3) should return without issue
2422
$result = $method->invoke($parser, 'TIME', 3);
2523
$this->assertNotEmpty($result);
2624
$this->assertTrue(is_string($result));
2725

28-
// Test variable args path - SUM has variable args
26+
// Variable args (SUM=-1) should return without issue
2927
$result = $method->invoke($parser, 'SUM', 2);
3028
$this->assertNotEmpty($result);
3129
$this->assertTrue(is_string($result));
3230

33-
// Test that invalid argument counts throw an exception
34-
// Create a function with invalid args value
3531
// Array structure: [function_number, arg_count, unknown, volatile_flag]
3632
$parser->_functions['INVALID'] = array(999, -2, 0, 0); // -2 is not valid
3733

@@ -55,30 +51,19 @@ public function testDuplicatePtgValues()
5551
{
5652
$parser = new Spreadsheet_Excel_Writer_Parser(0, 0x0500);
5753

58-
// Access protected property via reflection
5954
$property = new \ReflectionProperty($parser, 'ptg');
6055
$property->setAccessible(true);
6156
$ptg = $property->getValue($parser);
6257

63-
// Test ptgMemNoMemN - should have the LAST duplicate value
64-
// Original duplicates: 0x2F (commented), 0x4F (commented), 0x6F (active)
65-
$this->assertArrayHasKey('ptgMemNoMemN', $ptg,
66-
'ptgMemNoMemN key should exist in ptg array');
67-
$this->assertSame(0x6F, $ptg['ptgMemNoMemN'],
68-
'ptgMemNoMemN should be 0x6F (the last duplicate), not 0x2F or 0x4F');
58+
// ptgMemNoMemN: last duplicate at 0x6F wins (0x2F, 0x4F were overwritten)
59+
$this->assertArrayHasKey('ptgMemNoMemN', $ptg);
60+
$this->assertSame(0x6F, $ptg['ptgMemNoMemN']);
6961

70-
// Test ptgAreaErr3d - should have the LAST duplicate value
71-
// Original duplicates: 0x3D (commented), 0x5D (commented), 0x7D (active)
72-
$this->assertArrayHasKey('ptgAreaErr3d', $ptg,
73-
'ptgAreaErr3d key should exist in ptg array');
74-
$this->assertSame(0x7D, $ptg['ptgAreaErr3d'],
75-
'ptgAreaErr3d should be 0x7D (the last duplicate), not 0x3D or 0x5D');
62+
// ptgAreaErr3d: last duplicate at 0x7D wins (0x3D, 0x5D were overwritten)
63+
$this->assertArrayHasKey('ptgAreaErr3d', $ptg);
64+
$this->assertSame(0x7D, $ptg['ptgAreaErr3d']);
7665

77-
// The assertArrayHasKey calls above already verify these keys exist exactly once
78-
// (PHP arrays cannot have duplicate keys)
79-
80-
// Verify that ptgMemNoMem exists with value 0x28
81-
// (The duplicates at 0x48 and 0x68 are commented out per Excel spec)
82-
$this->assertSame(0x28, $ptg['ptgMemNoMem'], 'ptgMemNoMem should be 0x28');
66+
// ptgMemNoMem base variant at 0x28 (0x48, 0x68 duplicates removed per Excel spec)
67+
$this->assertSame(0x28, $ptg['ptgMemNoMem']);
8368
}
8469
}

0 commit comments

Comments
 (0)