aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/FauxResponseTest.php
Commit message (Collapse)AuthorAgeFilesLines
* Move trivially compatible tests to the unit tests suiteMáté Szabó2019-06-301-146/+0
| | | | | | | | | | | | | | | | | | | | | This changeset resumes work on T89432 and related tickets by porting an initial set of tests to the new unit test suite separated out in I69b92db3e70093570e05cc0a64c7780a278b321a. The tests were only ported if they worked immediately without requiring any changes other than changing the test case class to MediaWikiUnitTestCase and moving the test to the new suite. If a test failed for any reason (even trivial misconfiguration), it was NOT ported. With this change, the unit tests suite now consits of a total of 455 tests. As before, you can run these tests via the following command: $ composer phpunit:unit Bug: T84948 Bug: T89432 Bug: T87781 Change-Id: Ibb8175981092d7f41864e641cc3c118af70a5c76
* Revert "Separate MediaWiki unit and integration tests"Legoktm2019-06-131-0/+146
| | | | | | | | This reverts commit 0a2b996278e57a8b8c5377cd3a3eaa54f993d4a9. Reason for revert: Broke postgres tests. Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
* Separate MediaWiki unit and integration testsMáté Szabó2019-06-131-146/+0
| | | | | | | | | | | | | | | | | | | | | This changeset implements T89432 and related tickets and is based on exploration done at the Prague Hackathon. The goal is to identify tests in MediaWiki core that can be run without having to install & configure MediaWiki and its dependencies, and provide a way to execute these tests via the standard phpunit entry point, allowing for faster development and integration with existing tooling like IDEs. The initial set of tests that met these criteria were identified using the work Amir did in I88822667693d9e00ac3d4639c87bc24e5083e5e8. These tests were then moved into a new subdirectory under phpunit/ and organized into a separate test suite. The environment for this suite is set up via a PHPUnit bootstrap file without a custom entry point. You can execute these tests by running: $ vendor/bin/phpunit -d memory_limit=512M -c tests/phpunit/unit-tests.xml Bug: T89432 Bug: T87781 Bug: T84948 Change-Id: Iad01033a0548afd4d2a6f2c1ef6fcc9debf72c0d
* Remove comments literally documenting unit tests being unit testsThiemo Kreuz2019-02-191-2/+0
| | | | | | | | The name of the test class and method as well as the @covers tags already explain well enough which code a test is testing. Repeating this does not provide additional information. Change-Id: Ieec4ec131e5925d11704a11e1df46bc00c9fad9b
* Fix numerous class/function casingReedy2016-03-181-5/+5
| | | | Change-Id: I23982bfa0548c9ea3bdb432be7982f1563930715
* Convert all array() syntax to []Kunal Mehta2016-02-171-5/+5
| | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
* FauxResponse: Honor cookie options, and other cleanupBrad Jorsch2015-09-291-5/+28
| | | | | | | | | | | | | | | | | We have this nice class for unit testing cookie-setting, but the cookie-setting method ignores all the parameters! Fix that. Also provide accessors to check the entire set of cookie data, and the set cookies as a whole. While this does change the semantics of FauxRequest::getcookie() in that the name now needs to be prefixed, no extension in Gerrit uses this method so we should be fine. Also clean up the case of the setCookie and getCookie methods while we're at it. Since PHP method names are case-insensitive, this doesn't even break compatibility with extensions. Change-Id: Ib44a074bf9796bc0b470d557e39465792f399d30
* WebResponse: Implement statusHeader() using the new HttpStatus::header()Timo Tijhof2015-06-041-0/+7
| | | | | | | | | | | | | * Convert existing use of WebResponse::header() for HTTP status headers to use this new statusHeader() method. * Extend unit test forFauxResponse. I'm not calling HttpStatus::header directly in code. We keep the abstraction layer of WebResponse so that responses can continue to be mocked/fauxed without affecting the outer HTTP response. Change-Id: I8a536e16659fa88b54cffa1457efb889efa5fcd6
* Pass phpcs-strict on some test files (2/x)Siebrand Mazeland2014-04-241-8/+40
| | | | Change-Id: Ia39fd107a554206927652b6e168faa0da501b362
* @covers tags for inclues/*Testaddshore2013-10-241-1/+13
| | | | Change-Id: Id28acdd8fe0028bf1e46344cfed131076c8f4c95
* Fix scope on all /phpunit test methodsaddshore2013-10-241-3/+3
| | | | Change-Id: I3ce92463d485a0fb23e464e9a8059330f32d79af
* Make headers in FauxRequest case insensitivedaniel2013-06-031-0/+3
| | | | | | | HTTP headers are case insensitive per spec, and WebRequest treats them like that, so FauxRequest should too. Change-Id: I4257af7a8de2792ac556c670dcc7f28e4af4cb44
* tests: always call parent setUpAntoine Musso2012-10-231-0/+1
| | | | | | | | Some class extending MediaWikiTestCase did not call its setUp method. We most probably always want to do it since MediaWikiTestCase::setUp() does garbage collection and might do more in the future. Change-Id: I68dde370a62c8f4a779836ca0c4ad06844fdc916
* Clean and repair many phpunit tests (+ fix implied configuration)Timo Tijhof2012-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit depends on the introduction of MediaWikiTestCase::setMwGlobals in change Iccf6ea81f4. Various tests already set their globals, but forgot to restore them afterwards, or forgot to call the parent setUp, tearDown... Either way they won't have to anymore with setMwGlobals. Consistent use of function characteristics: * protected function setUp * protected function tearDown * public static function (provide..) (Matching the function signature with PHPUnit/Framework/TestCase.php) Replaces: * public function (setUp|tearDown)\( * protected function $1( * \tfunction (setUp|tearDown)\( * \tprotected function $1( * \tfunction (data|provide)\( * \tpublic static function $1\( Also renamed a few "data#", "provider#" and "provides#" functions to "provide#" for consistency. This also removes confusion where the /media tests had a few private methods called dataFile(), which were sometimes expected to be data providers. Fixes: TimestampTest often failed due to a previous test setting a different language (it tests "1 hour ago" so need to make sure it is set to English). MWNamespaceTest became a lot cleaner now that it executes with a known context. Though the now-redundant code that was removed didn't work anyway because wgContentNamespaces isn't keyed by namespace id, it had them was values... FileBackendTest: * Fixed: "PHP Fatal: Using $this when not in object context" HttpTest * Added comment about: "PHP Fatal: Call to protected MWHttpRequest::__construct()" (too much unrelated code to fix in this commit) ExternalStoreTest * Add an assertTrue as well, without it the test is useless because regardless of whether wgExternalStores is true or false it only uses it if it is an array. Change-Id: I9d2b148e57bada64afeb7d5a99bec0e58f8e1561
* * Added some tests for FauxResponse classAlexandre Emsenhuber2011-07-131-0/+70
* Made some fixes to that class and removed one unused variable Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/92094