Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Fixes #7022 TESTS_ZEND_HTTP_CLIENT_ONLINE check #7023

Closed
wants to merge 1 commit into from
Closed

Fixes #7022 TESTS_ZEND_HTTP_CLIENT_ONLINE check #7023

wants to merge 1 commit into from

Conversation

gianarb
Copy link
Contributor

@gianarb gianarb commented Dec 13, 2014

Tests works!
vendor/bin/phpunit tests/ZendTest/Http

@Martin-P
Copy link
Contributor

It looks like you should use the configuration file when running tests.
TestConfiguration.php.dist line 260:

defined('TESTS_ZEND_HTTP_CLIENT_ONLINE') || define('TESTS_ZEND_HTTP_CLIENT_ONLINE', false);

@gianarb
Copy link
Contributor Author

gianarb commented Dec 13, 2014

Ops thanks @Martin-P.. If this commit is wrong I close it @Ocramius

@Martin-P
Copy link
Contributor

You can copy phpunit.xml.dist and rename it to phpunit.xml. Then you change the contents of phpunit.xml so you can test your file:

<testsuite name="Zend Framework Test Suite">
    <!-- <directory>./ZendTest</directory> -->
    <exclude>./ZendTest/_files/</exclude>
    <exclude>./ZendTest/AllTests/</exclude>
    <file>./ZendTest/Http/Client/StaticTest.php</file>
</testsuite>

When using phpunit.xml, Bootstrap.php is used and in Bootstrap.php lines 53 - 61 the correct configuration is loaded:

/*
 * Load the user-defined test configuration file, if it exists; otherwise, load
 * the default configuration.
 */
if (is_readable($zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php')) {
    require_once $zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php';
} else {
    require_once $zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php.dist';
}

@Ocramius
Copy link
Member

Tests should run even without including that config, so the patch is actually correct.

@Ocramius Ocramius self-assigned this Dec 13, 2014
@Ocramius Ocramius added the bug label Dec 13, 2014
@Ocramius Ocramius added this to the 2.3.4 milestone Dec 13, 2014
@Martin-P
Copy link
Contributor

In that case there are more issues, because when I run the command as provided by @gianarb I get a fatal error:

Fatal error: Class 'ZendTest\Http\Client\CommonHttpTests' not found in path\to\vendor\zf2\tests\ZendTest\Http\Client\CurlTest.php on line 32

@Ocramius
Copy link
Member

@Martin-P looks like these tests were not run in a loooong time then...

@gianarb
Copy link
Contributor Author

gianarb commented Dec 14, 2014

@Martin-P ok for correct command to use configuration file..But for run tests I use
vendor/bin/phpunit tests/ZendTest/Http/
And I haven't your Fatal

@Ocramius
Copy link
Member

Merged, thanks!

master: e54cb16
develop: e868669

gianarb pushed a commit to zendframework/zend-http that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-http that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants