Commit graph

11 commits

Author SHA1 Message Date
Alexia E. Smith
2b28a56d8a mail: Always quote uncoded names in MailAddress
Otherwise, names that contain whitespace (but no special characters
that need Q-encoding) will be sent as-is in an email header. While
that's valid by RFC 1036, RFC 5322 and others, some mail programs
fail to correctly process spaces. Avoid these problems by simply
quoting the name always - except for cases which are Q-encoded,
which must remain unquoted to be valid (and also cannot contain
spaces, thus unaffected).

Before:
> From: Foo Bar <fb@example.org>

After:
> From "Foo Bar" <fb@example.org>

Update test to work with the new criteria.

Bug: T191931
Change-Id: I4b2a0a80e8b43ecc943939fc5ebaa356a4f840e0
2018-04-24 21:29:25 +00:00
Umherirrender
45da581551 Use ::class to resolve class names in tests
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: Ie541a7baae10ab6f5c13f95ac2ff6598b8f8950c
2018-01-26 22:49:13 +01:00
Timo Tijhof
447ce7e39a phpunit: Avoid use of deprecated getMock for PHPUnit 5 compat
The default will remain PHPUnit 4.x due to PHP 5.5 support.

But, we should allow developers to run tests with newer PHPUnit
versions which are noticably faster (especially for code coverage
reports).

* <https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-5.4.0>
  PHPUnit 5 deprecates the getMock() shortcut for getMockBuilder()->getMock().
  It instead introduces the shortcut createMock() which has better defaults
  than getMockBuilder(). For example, it sets 'disableArgumentCloning' and
  other things by default.

  Going forward, code should either use getMockBuilder directly and configure
  it using the setter methods (instead of the confusing variadic arguments
  of getMock) or simply use the new minimalistic createMock method. This patch
  backports the createMock method to MediaWikiTestCase so that we can start
  using it.

Change-Id: I091c0289b21d2b1c876adba89529dc3e72b99af2
2017-04-06 00:44:32 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
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
2016-02-17 01:33:00 -08:00
Amir E. Aharoni
bfdd3369c2 Fix Generic.Files.LineLength phpcs check in files under phpunit/includes
Bug: T102614
Change-Id: Iee3df5f064f595ecebe8210cc936bc3d20a122c9
2015-10-03 17:13:29 +00:00
jenkins-bot
f330eea930 Merge "Skip MailAddressTest::testNewFromUser on windows" 2014-09-30 22:38:47 +00:00
umherirrender
df24b7209d Fixed spacing
- Added newline at end of file
- Removed double spaces/newlines
- Added space after if/function and parentheses/brackets
- Removed space before comma/cast
- Fixed indent of some lines

Change-Id: I29867ffdffdfb7d2b56997e9393497c7dc12f7d3
2014-09-29 20:46:19 +02:00
umherirrender
4654a2e802 Skip MailAddressTest::testNewFromUser on windows
1) MailAddressTest::testNewFromUser
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Real name <foo@bar.baz>'
+'foo@bar.baz'

Change-Id: I0c9724130730c39a355c22d06b2c0f0629c1d0e3
2014-09-27 11:43:47 +02:00
Kunal Mehta
3a34ae5731 Improve coverage of MailAddress::toString()
Change-Id: I8d5a1e8f293afa03d94167b722d3078f467cf59e
2014-09-21 18:17:38 -07:00
Kunal Mehta
eab5a7d6ef Add MailAddress::newFromUser()
And tests!

Change-Id: I5214c50855f6bc756f6d748e435ae2124b2264c1
2014-09-14 19:03:18 +00:00
Kunal Mehta
c1e9250124 Add tests for MailAddress
Change-Id: Ia192919322743854096aceb24be0fcf9b1aa32b4
2014-09-14 19:03:13 +00:00