Server IP : 127.0.0.2 / Your IP : 3.141.202.216 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/vendor/phpunit/phpunit/tests/Util/ |
Upload File : |
<?php /* * This file is part of PHPUnit. * * (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. */ /** * @author Henrique Moody <henriquemoody@gmail.com> * @copyright Sebastian Bergmann <sebastian@phpunit.de> * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License * * @link http://www.phpunit.de/ */ class PHPUnit_Util_PHPTest extends PHPUnit_Framework_TestCase { public function testShouldNotUseStderrRedirectionByDefault() { $phpMock = $this->getMockForAbstractClass('PHPUnit_Util_PHP'); $this->assertFalse($phpMock->useStderrRedirection()); } public function testShouldDefinedIfUseStderrRedirection() { $phpMock = $this->getMockForAbstractClass('PHPUnit_Util_PHP'); $phpMock->setUseStderrRedirection(true); $this->assertTrue($phpMock->useStderrRedirection()); } public function testShouldDefinedIfDoNotUseStderrRedirection() { $phpMock = $this->getMockForAbstractClass('PHPUnit_Util_PHP'); $phpMock->setUseStderrRedirection(false); $this->assertFalse($phpMock->useStderrRedirection()); } /** * @expectedException PHPUnit_Framework_Exception * @expectedExceptionMessage Argument #1 (No Value) of PHPUnit_Util_PHP::setUseStderrRedirection() must be a boolean */ public function testShouldThrowsExceptionWhenStderrRedirectionVariableIsNotABoolean() { $phpMock = $this->getMockForAbstractClass('PHPUnit_Util_PHP'); $phpMock->setUseStderrRedirection(null); } public function testShouldUseGivenSettingsToCreateCommand() { $phpMock = $this->getMockForAbstractClass('PHPUnit_Util_PHP'); $settings = [ 'allow_url_fopen=1', 'auto_append_file=', 'display_errors=1', ]; $expectedCommandFormat = '%s -d allow_url_fopen=1 -d auto_append_file= -d display_errors=1'; $actualCommand = $phpMock->getCommand($settings); $this->assertStringMatchesFormat($expectedCommandFormat, $actualCommand); } public function testShouldRedirectStderrToStdoutWhenDefined() { $phpMock = $this->getMockForAbstractClass('PHPUnit_Util_PHP'); $phpMock->setUseStderrRedirection(true); $expectedCommandFormat = '%s 2>&1'; $actualCommand = $phpMock->getCommand([]); $this->assertStringMatchesFormat($expectedCommandFormat, $actualCommand); } public function testShouldUseArgsToCreateCommand() { $phpMock = $this->getMockForAbstractClass('PHPUnit_Util_PHP'); $phpMock->setArgs('foo=bar'); $expectedCommandFormat = '%s -- foo=bar'; $actualCommand = $phpMock->getCommand([]); $this->assertStringMatchesFormat($expectedCommandFormat, $actualCommand); } public function testShouldHaveFileToCreateCommand() { $phpMock = $this->getMockForAbstractClass('PHPUnit_Util_PHP'); $expectedCommandFormat = '%s -%c \'file.php\''; $actualCommand = $phpMock->getCommand([], 'file.php'); $this->assertStringMatchesFormat($expectedCommandFormat, $actualCommand); } public function testStdinGetterAndSetter() { $phpMock = $this->getMockForAbstractClass('PHPUnit_Util_PHP'); $phpMock->setStdin('foo'); $this->assertEquals('foo', $phpMock->getStdin()); } public function testArgsGetterAndSetter() { $phpMock = $this->getMockForAbstractClass('PHPUnit_Util_PHP'); $phpMock->setArgs('foo=bar'); $this->assertEquals('foo=bar', $phpMock->getArgs()); } public function testEnvGetterAndSetter() { $phpMock = $this->getMockForAbstractClass('PHPUnit_Util_PHP'); $phpMock->setEnv(['foo' => 'bar']); $this->assertEquals(['foo' => 'bar'], $phpMock->getEnv()); } public function testTimeoutGetterAndSetter() { $phpMock = $this->getMockForAbstractClass('PHPUnit_Util_PHP'); $phpMock->setTimeout(30); $this->assertEquals(30, $phpMock->getTimeout()); } }