| @@ 16-59 (lines=44) @@ | ||
| 13 | * @package PHPCompatibility |
|
| 14 | * @author Wim Godden <[email protected]> |
|
| 15 | */ |
|
| 16 | class NewFunctionParameterSniffTest extends BaseSniffTest |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * Test dirname() depth parameter |
|
| 20 | * |
|
| 21 | * @return void |
|
| 22 | */ |
|
| 23 | public function testDirnameDepth() |
|
| 24 | { |
|
| 25 | $file = $this->sniffFile('sniff-examples/new_function_parameter.php', '5.6'); |
|
| 26 | $this->assertError($file, 3, "The function dirname does not have a parameter depth in PHP version 5.6 or earlier"); |
|
| 27 | ||
| 28 | $file = $this->sniffFile('sniff-examples/new_function_parameter.php', '7.0'); |
|
| 29 | $this->assertNoViolation($file, 3); |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Test unserialize() options parameter |
|
| 34 | * |
|
| 35 | * @return void |
|
| 36 | */ |
|
| 37 | public function testUnserializeOptions() |
|
| 38 | { |
|
| 39 | $file = $this->sniffFile('sniff-examples/new_function_parameter.php', '5.6'); |
|
| 40 | $this->assertError($file, 5, "The function unserialize does not have a parameter options in PHP version 5.6 or earlier"); |
|
| 41 | ||
| 42 | $file = $this->sniffFile('sniff-examples/new_function_parameter.php', '7.0'); |
|
| 43 | $this->assertNoViolation($file, 5); |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * Test session_start() options parameter |
|
| 48 | * |
|
| 49 | * @return void |
|
| 50 | */ |
|
| 51 | public function testSessionStartOptions() |
|
| 52 | { |
|
| 53 | $file = $this->sniffFile('sniff-examples/new_function_parameter.php', '5.6'); |
|
| 54 | $this->assertError($file, 7, "The function session_start does not have a parameter options in PHP version 5.6 or earlier"); |
|
| 55 | ||
| 56 | $file = $this->sniffFile('sniff-examples/new_function_parameter.php', '7.0'); |
|
| 57 | $this->assertNoViolation($file, 7); |
|
| 58 | } |
|
| 59 | } |
|
| 60 | ||
| @@ 16-59 (lines=44) @@ | ||
| 13 | * @package PHPCompatibility |
|
| 14 | * @author Wim Godden <[email protected]> |
|
| 15 | */ |
|
| 16 | class RemovedFunctionParameterSniffTest extends BaseSniffTest |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * Test mktime() is_dst parameter |
|
| 20 | * |
|
| 21 | * @return void |
|
| 22 | */ |
|
| 23 | public function testMktimeIsdst() |
|
| 24 | { |
|
| 25 | $file = $this->sniffFile('sniff-examples/removed_function_parameter.php', '5.0'); |
|
| 26 | $this->assertNoViolation($file, 3); |
|
| 27 | ||
| 28 | $file = $this->sniffFile('sniff-examples/removed_function_parameter.php', '7.0'); |
|
| 29 | $this->assertError($file, 3, "The function mktime does not have a parameter is_dst in PHP version 7.0 or later"); |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Test gmmktime() is_dst parameter |
|
| 34 | * |
|
| 35 | * @return void |
|
| 36 | */ |
|
| 37 | public function testGmmktimeIsdst() |
|
| 38 | { |
|
| 39 | $file = $this->sniffFile('sniff-examples/removed_function_parameter.php', '5.6'); |
|
| 40 | $this->assertNoViolation($file, 5); |
|
| 41 | ||
| 42 | $file = $this->sniffFile('sniff-examples/removed_function_parameter.php', '7.0'); |
|
| 43 | $this->assertError($file, 5, "The function gmmktime does not have a parameter is_dst in PHP version 7.0 or later"); |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * Test session_start() options parameter |
|
| 48 | * |
|
| 49 | * @return void |
|
| 50 | */ |
|
| 51 | public function testSessionStartOptions() |
|
| 52 | { |
|
| 53 | $file = $this->sniffFile('sniff-examples/new_function_parameter.php', '5.6'); |
|
| 54 | $this->assertError($file, 7, "The function session_start does not have a parameter options in PHP version 5.6 or earlier"); |
|
| 55 | ||
| 56 | $file = $this->sniffFile('sniff-examples/new_function_parameter.php', '7.0'); |
|
| 57 | $this->assertNoViolation($file, 7); |
|
| 58 | } |
|
| 59 | } |
|
| 60 | ||