diff --git a/.travis.yml b/.travis.yml index d93f0eea..fb7ec6d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,8 @@ matrix: - php: hhvm script: - - vendor/bin/tester tests -s - - php code-checker/src/code-checker.php -d src + - vendor/bin/tester tests -s -p php + - php code-checker/src/code-checker.php after_failure: # Print *.actual content @@ -20,5 +20,11 @@ after_failure: before_script: # Install Nette Tester & Code Checker - - composer install --no-interaction --dev --prefer-source - - composer create-project nette/code-checker code-checker ~2.2 --no-interaction --prefer-source + - travis_retry composer install --no-interaction --prefer-dist + - travis_retry composer create-project nette/code-checker code-checker ~2.5 --no-interaction + +sudo: false + +cache: + directories: + - $HOME/.composer/cache diff --git a/contributing.md b/contributing.md new file mode 100644 index 00000000..a1cbbd53 --- /dev/null +++ b/contributing.md @@ -0,0 +1,27 @@ +How to contribute & use the issue tracker +========================================= + +The issue tracker is the preferred channel for bug reports, features requests +and submitting pull requests, but please respect the following restrictions: + +* Please **do not** use the issue tracker for personal support requests (use + [Nette forum](http://forum.nette.org) or [Stack Overflow](http://stackoverflow.com)). + +* Please **do not** derail or troll issues. Keep the discussion on topic and + respect the opinions of others. + +* Use the GitHub **issue search** — check if the issue has already been + reported. + +A good **bug report** shouldn't leave others needing to chase you up for more +information. Please try to be as detailed as possible in your report. + +**Feature requests** are welcome. But take a moment to find out whether your idea +fits with the scope and aims of the project. It's up to *you* to make a strong +case to convince the project's developers of the merits of this feature. + +Nette welcomes **pull requests**. If you'd like to contribute, please take a moment +to [read the guidelines](http://nette.org/en/contributing) in order to make +the contribution process easy and effective for everyone involved. + +Thanks! diff --git a/src/Mail/Message.php b/src/Mail/Message.php index 44fb6a33..43bc5838 100644 --- a/src/Mail/Message.php +++ b/src/Mail/Message.php @@ -7,8 +7,8 @@ namespace Nette\Mail; -use Nette, - Nette\Utils\Strings; +use Nette; +use Nette\Utils\Strings; /** @@ -333,7 +333,7 @@ public function generateMessage() /** * Builds email. Does not modify itself, but returns a new object. - * @return Message + * @return self */ protected function build() { @@ -387,7 +387,7 @@ protected function buildText($html) { $text = Strings::replace($html, array( '#<(style|script|head).*#Uis' => '', - '#]#i' => " $0", + '#]#i' => ' $0', '#[\r\n]+#' => ' ', '#<(/?p|/?h\d|li|br|/tr)[ >/]#i' => "\n$0", )); diff --git a/src/Mail/MimePart.php b/src/Mail/MimePart.php index d4400255..91b8e8f9 100644 --- a/src/Mail/MimePart.php +++ b/src/Mail/MimePart.php @@ -7,8 +7,8 @@ namespace Nette\Mail; -use Nette, - Nette\Utils\Strings; +use Nette; +use Nette\Utils\Strings; /** diff --git a/src/Mail/SendmailMailer.php b/src/Mail/SendmailMailer.php index ecaa7cf1..763abe88 100644 --- a/src/Mail/SendmailMailer.php +++ b/src/Mail/SendmailMailer.php @@ -42,7 +42,7 @@ public function send(Message $mail) if ($this->commandArgs) { $args[] = (string) $this->commandArgs; } - $res = Nette\Utils\Callback::invokeSafe('mail', $args, function($message) use (& $info) { + $res = Nette\Utils\Callback::invokeSafe('mail', $args, function ($message) use (& $info) { $info = ": $message"; }); if ($res === FALSE) { diff --git a/tests/Mail/Mail.HtmlBody.phpt b/tests/Mail/Mail.HtmlBody.phpt index 0f77ed74..fd6451a4 100644 --- a/tests/Mail/Mail.HtmlBody.phpt +++ b/tests/Mail/Mail.HtmlBody.phpt @@ -4,8 +4,8 @@ * Test: Nette\Mail\Message - HTML body. */ -use Nette\Mail\Message, - Tester\Assert; +use Nette\Mail\Message; +use Tester\Assert; require __DIR__ . '/../bootstrap.php'; @@ -24,7 +24,7 @@ $mail->setHTMLBody('Příliš žluťoučký
kůň
'); $mailer = new TestMailer(); $mailer->send($mail); -Assert::match( <<Příliš žluťoučký
kůň ----------%S%-- EOD -, TestMailer::$output ); +, TestMailer::$output); diff --git a/tests/Mail/Mail.attachment.phpt b/tests/Mail/Mail.attachment.phpt index c8a771b5..81286e40 100644 --- a/tests/Mail/Mail.attachment.phpt +++ b/tests/Mail/Mail.attachment.phpt @@ -4,8 +4,8 @@ * Test: Nette\Mail\Message - attachments. */ -use Nette\Mail\Message, - Tester\Assert; +use Nette\Mail\Message; +use Tester\Assert; require __DIR__ . '/../bootstrap.php'; @@ -19,7 +19,7 @@ $mail = new Message(); $mail->addAttachment(__DIR__ . '/files/example.zip', NULL, 'application/zip'); $mailer->send($mail); -Assert::match( <<addAttachment(__DIR__ . '/files/example.zip', NULL, 'application/zip') ->setEncoding(Message::ENCODING_QUOTED_PRINTABLE); $mailer->send($mail); -Assert::match( <<addAttachment($name, file_get_contents(__DIR__ . '/files/example.zip'), 'application/zip'); $mailer->send($mail); -Assert::match( <<setFrom('John Doe '); }, 'Nette\Utils\AssertionException', "The header 'From' expects to be email, string 'doe@example. com' given."); -Assert::exception(function() use ($mail) { +Assert::exception(function () use ($mail) { $mail->setFrom('John Doe <>'); }, 'Nette\Utils\AssertionException', "The header 'From' expects to be email, string '' given."); -Assert::exception(function() use ($mail) { +Assert::exception(function () use ($mail) { $mail->setFrom('John Doe '); }, 'Nette\Utils\AssertionException', "The header 'From' expects to be email, string 'doe@examplecom' given."); -Assert::exception(function() use ($mail) { +Assert::exception(function () use ($mail) { $mail->setFrom('John Doe'); }, 'Nette\Utils\AssertionException', "The header 'From' expects to be email, string 'John Doe' given."); -Assert::exception(function() use ($mail) { +Assert::exception(function () use ($mail) { $mail->setFrom('doe;@examplecom'); }, 'Nette\Utils\AssertionException', "The header 'From' expects to be email, string 'doe;@examplecom' given."); -Assert::exception(function() use ($mail) { +Assert::exception(function () use ($mail) { // addReplyTo $mail->addReplyTo('@'); }, 'Nette\Utils\AssertionException', "The header 'Reply-To' expects to be email, string '@' given."); -Assert::exception(function() use ($mail) { +Assert::exception(function () use ($mail) { // addTo $mail->addTo('@'); }, 'Nette\Utils\AssertionException', "The header 'To' expects to be email, string '@' given."); -Assert::exception(function() use ($mail) { +Assert::exception(function () use ($mail) { // addCc $mail->addCc('@'); }, 'Nette\Utils\AssertionException', "The header 'Cc' expects to be email, string '@' given."); -Assert::exception(function() use ($mail) { +Assert::exception(function () use ($mail) { // addBcc $mail->addBcc('@'); }, 'Nette\Utils\AssertionException', "The header 'Bcc' expects to be email, string '@' given."); diff --git a/tests/Mail/Mail.email.long.phpt b/tests/Mail/Mail.email.long.phpt index f69e4fcc..eff9c74b 100644 --- a/tests/Mail/Mail.email.long.phpt +++ b/tests/Mail/Mail.email.long.phpt @@ -4,8 +4,8 @@ * Test: Nette\Mail\Message valid email addresses. */ -use Nette\Mail\Message, - Tester\Assert; +use Nette\Mail\Message; +use Tester\Assert; require __DIR__ . '/../bootstrap.php'; @@ -24,7 +24,7 @@ $mail->addBcc('veryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryv $mailer = new TestMailer(); $mailer->send($mail); -Assert::match( << Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit EOD -, TestMailer::$output ); +, TestMailer::$output); diff --git a/tests/Mail/Mail.email.multiple.phpt b/tests/Mail/Mail.email.multiple.phpt index fc51f37d..6b96be7b 100644 --- a/tests/Mail/Mail.email.multiple.phpt +++ b/tests/Mail/Mail.email.multiple.phpt @@ -4,8 +4,8 @@ * Test: Nette\Mail\Message - textual body. */ -use Nette\Mail\Message, - Tester\Assert; +use Nette\Mail\Message; +use Tester\Assert; require __DIR__ . '/../bootstrap.php'; @@ -27,7 +27,7 @@ $mail->setBody('Žluťoučký kůň'); $mailer = new TestMailer(); $mailer->send($mail); -Assert::match( <<setReturnPath('doe@example.com'); $mailer = new TestMailer(); $mailer->send($mail); -Assert::match( <<<'EOD' +Assert::match(<<<'EOD' MIME-Version: 1.0 X-Mailer: Nette Framework Date: %a% @@ -53,4 +53,4 @@ Message-ID: <%a%@%a%> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit EOD -, TestMailer::$output ); +, TestMailer::$output); diff --git a/tests/Mail/Mail.headers.001.phpt b/tests/Mail/Mail.headers.001.phpt index efbb7d56..bd33563b 100644 --- a/tests/Mail/Mail.headers.001.phpt +++ b/tests/Mail/Mail.headers.001.phpt @@ -4,8 +4,8 @@ * Test: Nette\Mail\Message invalid headers. */ -use Nette\Mail\Message, - Tester\Assert; +use Nette\Mail\Message; +use Tester\Assert; require __DIR__ . '/../bootstrap.php'; @@ -15,14 +15,14 @@ require __DIR__ . '/Mail.inc'; $mail = new Message(); -Assert::exception(function() use ($mail) { +Assert::exception(function () use ($mail) { $mail->setHeader('', 'value'); }, 'InvalidArgumentException', "Header name must be non-empty alphanumeric string, '' given."); -Assert::exception(function() use ($mail) { +Assert::exception(function () use ($mail) { $mail->setHeader(' name', 'value'); }, 'InvalidArgumentException', "Header name must be non-empty alphanumeric string, ' name' given."); -Assert::exception(function() use ($mail) { +Assert::exception(function () use ($mail) { $mail->setHeader('n*ame', 'value'); }, 'InvalidArgumentException', "Header name must be non-empty alphanumeric string, 'n*ame' given."); diff --git a/tests/Mail/Mail.headers.002.phpt b/tests/Mail/Mail.headers.002.phpt index 38eb7d7e..fbf5c1a2 100644 --- a/tests/Mail/Mail.headers.002.phpt +++ b/tests/Mail/Mail.headers.002.phpt @@ -4,8 +4,8 @@ * Test: Nette\Mail\Message valid headers. */ -use Nette\Mail\Message, - Tester\Assert; +use Nette\Mail\Message; +use Tester\Assert; require __DIR__ . '/../bootstrap.php'; @@ -31,7 +31,7 @@ $mail->setHeader('X-Gmail-Label', 'love'); $mailer = new TestMailer(); $mailer->send($mail); -Assert::match( << Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit EOD -, TestMailer::$output ); +, TestMailer::$output); diff --git a/tests/Mail/Mail.inc b/tests/Mail/Mail.inc index 13fe42ee..50fe611f 100644 --- a/tests/Mail/Mail.inc +++ b/tests/Mail/Mail.inc @@ -4,8 +4,8 @@ * Common code for Mail test cases. */ -use Nette\Mail\Message, - Nette\Mail\IMailer; +use Nette\Mail\Message; +use Nette\Mail\IMailer; class TestMailer implements IMailer diff --git a/tests/Mail/Mail.longLines.phpt b/tests/Mail/Mail.longLines.phpt index 3f7b6470..f29d4d39 100644 --- a/tests/Mail/Mail.longLines.phpt +++ b/tests/Mail/Mail.longLines.phpt @@ -4,8 +4,8 @@ * Test: Nette\Mail\Message - textual body and line longer than 990 characters. */ -use Nette\Mail\Message, - Tester\Assert; +use Nette\Mail\Message; +use Tester\Assert; require __DIR__ . '/../bootstrap.php'; @@ -27,7 +27,7 @@ $mail->setBody('Žluťoučký kůň' . str_repeat('x', 990)); $mailer = new TestMailer(); $mailer->send($mail); -Assert::match( <<setSubject('Testovací ! od žluťoučkého koně ...'); $mailer->send($mail); -Assert::match( 'MIME-Version: 1.0 +Assert::match('MIME-Version: 1.0 X-Mailer: Nette Framework Date: %a% Subject: =?UTF-8?B?VGVzdG92YWPDrSAhIDxlbWFpbD4gb2Qgxb5sdcWlb3XEjWs=?= @@ -27,26 +27,26 @@ Subject: =?UTF-8?B?VGVzdG92YWPDrSAhIDxlbWFpbD4gb2Qgxb5sdcWlb3XEjWs=?= Message-ID: <%S%@%S%> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit -', TestMailer::$output ); +', TestMailer::$output); $mail = new Message(); $mail->setSubject('veryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylongemail'); $mailer->send($mail); -Assert::match( 'MIME-Version: 1.0 +Assert::match('MIME-Version: 1.0 X-Mailer: Nette Framework Date: %a% Subject: veryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylongemail Message-ID: <%S%@%S%> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit -', TestMailer::$output ); +', TestMailer::$output); $mail = new Message(); $mail->setSubject('veryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylongemailšššššššššššššššš'); $mailer->send($mail); -Assert::match( 'MIME-Version: 1.0 +Assert::match('MIME-Version: 1.0 X-Mailer: Nette Framework Date: %a% Subject: =?UTF-8?B?dmVyeXZlcnl2ZXJ5dmVyeXZlcnl2ZXJ5dmVyeXZlcnl2ZXI=?= @@ -56,13 +56,13 @@ Subject: =?UTF-8?B?dmVyeXZlcnl2ZXJ5dmVyeXZlcnl2ZXJ5dmVyeXZlcnl2ZXI=?= Message-ID: <%S%@%S%> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit -', TestMailer::$output ); +', TestMailer::$output); $mail = new Message(); $mail->setSubject('==========================================================================================ššššššššššššššššš'); $mailer->send($mail); -Assert::match( 'MIME-Version: 1.0 +Assert::match('MIME-Version: 1.0 X-Mailer: Nette Framework Date: %a% Subject: =?UTF-8?B?PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0=?= @@ -73,4 +73,4 @@ Message-ID: <%S%@%S%> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit -', TestMailer::$output ); +', TestMailer::$output); diff --git a/tests/Mail/Mail.textualAndHtmlBody.attachment.phpt b/tests/Mail/Mail.textualAndHtmlBody.attachment.phpt index 1f6d4dd1..a7eba72e 100644 --- a/tests/Mail/Mail.textualAndHtmlBody.attachment.phpt +++ b/tests/Mail/Mail.textualAndHtmlBody.attachment.phpt @@ -4,8 +4,8 @@ * Test: Nette\Mail\Message - textual and HTML body with attachment. */ -use Nette\Mail\Message, - Tester\Assert; +use Nette\Mail\Message; +use Tester\Assert; require __DIR__ . '/../bootstrap.php'; diff --git a/tests/Mail/Mail.textualAndHtmlBody.embedded.attachment.phpt b/tests/Mail/Mail.textualAndHtmlBody.embedded.attachment.phpt index febcc01d..eab64bf6 100644 --- a/tests/Mail/Mail.textualAndHtmlBody.embedded.attachment.phpt +++ b/tests/Mail/Mail.textualAndHtmlBody.embedded.attachment.phpt @@ -4,8 +4,8 @@ * Test: Nette\Mail\Message - textual and HTML body with embedded image and attachment. */ -use Nette\Mail\Message, - Tester\Assert; +use Nette\Mail\Message; +use Tester\Assert; require __DIR__ . '/../bootstrap.php'; diff --git a/tests/Mail/Mail.textualAndHtmlBody.embedded.phpt b/tests/Mail/Mail.textualAndHtmlBody.embedded.phpt index 190f43aa..c5a6cce9 100644 --- a/tests/Mail/Mail.textualAndHtmlBody.embedded.phpt +++ b/tests/Mail/Mail.textualAndHtmlBody.embedded.phpt @@ -4,8 +4,8 @@ * Test: Nette\Mail\Message - textual and HTML body with embedded image. */ -use Nette\Mail\Message, - Tester\Assert; +use Nette\Mail\Message; +use Tester\Assert; require __DIR__ . '/../bootstrap.php'; diff --git a/tests/Mail/Mail.textualAndHtmlBody.phpt b/tests/Mail/Mail.textualAndHtmlBody.phpt index 8ddcb409..9c6b032f 100644 --- a/tests/Mail/Mail.textualAndHtmlBody.phpt +++ b/tests/Mail/Mail.textualAndHtmlBody.phpt @@ -4,8 +4,8 @@ * Test: Nette\Mail\Message - textual and HTML body. */ -use Nette\Mail\Message, - Tester\Assert; +use Nette\Mail\Message; +use Tester\Assert; require __DIR__ . '/../bootstrap.php'; @@ -26,7 +26,7 @@ $mail->setHTMLBody('Žluťoučký kůň'); $mailer = new TestMailer(); $mailer->send($mail); -Assert::match( <<Žluťoučký kůň ----------%S%-- EOD -, TestMailer::$output ); +, TestMailer::$output); diff --git a/tests/Mail/Mail.textualBody.attachment.phpt b/tests/Mail/Mail.textualBody.attachment.phpt index 39ceccc9..2f35d0e9 100644 --- a/tests/Mail/Mail.textualBody.attachment.phpt +++ b/tests/Mail/Mail.textualBody.attachment.phpt @@ -4,8 +4,8 @@ * Test: Nette\Mail\Message - textual body with attachment. */ -use Nette\Mail\Message, - Tester\Assert; +use Nette\Mail\Message; +use Tester\Assert; require __DIR__ . '/../bootstrap.php'; @@ -26,7 +26,7 @@ $mail->addAttachment(__DIR__ . '/files/example.zip', NULL, 'application/zip'); $mailer = new TestMailer(); $mailer->send($mail); -Assert::match( <<setBody('Žluťoučký kůň'); $mailer = new TestMailer(); $mailer->send($mail); -Assert::match( <<