diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2011-08-14 15:52:11 -0400 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2011-08-14 15:52:11 -0400 |
commit | 5305f6a977eeb3c8455180d54c6a2f43639866f9 (patch) | |
tree | 7dd440cf4ea0dee84f507ceb61b24014c5cd0eac /tests/network | |
parent | 6fa83ba876c6ec780e51554a09b7937928e7ce0c (diff) | |
parent | a6dd3d0c65026bdeadd312f726f3197263607a04 (diff) | |
download | forums-5305f6a977eeb3c8455180d54c6a2f43639866f9.tar forums-5305f6a977eeb3c8455180d54c6a2f43639866f9.tar.gz forums-5305f6a977eeb3c8455180d54c6a2f43639866f9.tar.bz2 forums-5305f6a977eeb3c8455180d54c6a2f43639866f9.tar.xz forums-5305f6a977eeb3c8455180d54c6a2f43639866f9.zip |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/9297] Add network to class name of unit tests.
[ticket/9297] Fix typo in localhost.
[ticket/9297] Rename test class to reflect its contents.
[ticket/9297] Adjust comment - IPv6 is needed for IPv6 connections to work.
[ticket/9297] Fix markTestSkipped call in setUpBeforeClass.
[ticket/9297] Skip FTP PASV/EPSV test if FTP connection fails.
[ticket/9297] Separate ipv4 and ipv6 tests into separate functions.
[ticket/9297] Update copyright year of unit test file.
[ticket/9297] Make EPSV unit tests work without IPv6.
[ticket/9297] Unit tests for ftp_fsock PASV and EPSV.
[ticket/9297] Add support for Extended Passive Mode (EPSV) in ftp_fsock class.
Diffstat (limited to 'tests/network')
-rw-r--r-- | tests/network/ftp_fsock_pasv_epsv_test.php | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/network/ftp_fsock_pasv_epsv_test.php b/tests/network/ftp_fsock_pasv_epsv_test.php new file mode 100644 index 0000000000..6ad811e3ca --- /dev/null +++ b/tests/network/ftp_fsock_pasv_epsv_test.php @@ -0,0 +1,63 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2011 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_transfer.php'; + +/** +* @group slow +*/ +class phpbb_network_ftp_fsock_pasv_epsv_test extends phpbb_test_case +{ + static protected $ipv4; + + static public function setUpBeforeClass() + { + $hostname = 'ftp.debian.org.'; + self::$ipv4 = gethostbyname($hostname); + + if (self::$ipv4 == $hostname) + { + self::markTestSkipped("Got no A record back from DNS query for $hostname"); + } + } + + public function test_pasv() + { + // PASV + $this->assert_ls_contains_debian(self::$ipv4); + } + + public function test_epsv() + { + $ipv4 = self::$ipv4; + // EPSV + $this->assert_ls_contains_debian("[::ffff:$ipv4]"); + } + + protected function assert_ls_contains_debian($hostname) + { + $o = $this->get_object($hostname); + $result = $o->_init(); + // This test may fail on IPv6 addresses if IPv6 support is + // not available. PHP must be compiled with IPv6 support enabled, + // and your operating system must be configured for IPv6 as well. + if ($result !== true) + { + $this->markTestSkipped("Failed to connect to $hostname: $result"); + } + $this->assertContains('debian', $o->_ls()); + $o->_close(); + } + + protected function get_object($hostname) + { + return new ftp_fsock($hostname, 'anonymous', 'anonymous@localhost.tld', '/'); + } +} |